Guys,
I just created ISPN-532 (HotRodMarshaller needs cleaning up) targeted for Radegast CR2 and
Final. I know it is late in the day to be making API changes in an interface, but I would
much rather this is done right prior to being baked into Final and hence eternity. :)
http://fisheye.jboss.org/browse/Infinispan/trunk/client/hotrod-client/src...
So I have 3 issues to address with this interface.
1. Methods on the interface
The purpose of this is simple: the 2 methods, readObject() and marshallObject() are meant
to perform diametrically opposed tasks (byte[] -> object in one case, object ->
byte[] in the other) but the names are far from that.
I propose either of the following:
1) readObject() and writeObject()
2) Simply, read() and write()
3) Or if we want to follow org.infinispan.marshall.Marshaller conventions,
objectFromByteBuffer(), objectToByteBuffer()
My preference would be (3).
2. Interface name and package
Further, any reason why we call this HotRodMarshaller? Isn't it just a marshaller
that serializes arbitrary objects <--> byte[] and should contain no HotRod-specific
logic? I can see why we did not use the org.infinispan.marshall.Marshaller interface for
this (too complex?) but perhaps we could create a org.infinispan.marshall.BasicMarshaller
which just contains objectFromByteBuffer() and objectToByteBuffer(), and Marshaller can
extend BasicMarshaller for Infinispan's internals and HotRod clients can directly
implement BasicMarshaller?
This would allow people who write custom marshallers to reuse them for both the HotRod
client as well as for Infinispan's internal marshalling.
3. isKeyHint parameter on marshallObject()
What is this for? And surely there is a more elegant/generic way to achieve this?
Cheers
Manik
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org