|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Marshaller
A marshaller is a class that is able to marshall and unmarshall objects efficiently.
The reason why this is implemented specially in JBoss Cache rather than resorting to Java serialization or even the more efficient JBoss serialization is that a lot of efficiency can be gained when a majority of the serialization that occurs has to do with a small set of known types such asFqn
or ReplicableCommand
, and class type information
can be replaced with simple magic numbers.
Unknown types (typically user data) falls back to JBoss serialization.
In addition, using a marshaller allows adding additional data to the byte stream, such as context
class loader information on which class loader to use to deserialize the object stream, or versioning
information to allow streams to interoperate between different versions of JBoss Cache (see VersionAwareMarshaller
This interface implements the JGroups building-block interface RpcDispatcher.Marshaller
which
is used to marshall ReplicableCommand
s, their parameters and their response values.
The interface is also used by the CacheLoader
framework to efficiently serialize data to be persisted, as well as
the StateTransferManager
when serializing the cache for transferring state en-masse.
Method Summary | |
---|---|
Object |
objectFromObjectStream(ObjectInputStream in)
Unmarshalls an object from an ObjectInputStream |
Object |
objectFromStream(InputStream is)
Unmarshalls an object from an InputStream |
ByteBuffer |
objectToBuffer(Object o)
A specialized form of RpcDispatcher.Marshaller2.objectToBuffer(Object) that returns an instance
of ByteBuffer instead of Buffer . |
void |
objectToObjectStream(Object obj,
ObjectOutputStream out)
Marshalls an object to a given ObjectOutputStream |
void |
objectToObjectStream(Object obj,
ObjectOutputStream out,
Fqn region)
Overloaded form of objectToObjectStream(Object,java.io.ObjectOutputStream) which adds a hint to the Fqn region |
RegionalizedMethodCall |
regionalizedMethodCallFromByteBuffer(byte[] buffer)
Returns a RegionalizedMethodCall from a byte buffer. |
RegionalizedMethodCall |
regionalizedMethodCallFromObjectStream(ObjectInputStream in)
Returns a RegionalizedMethodCall from an object input stream. |
Methods inherited from interface org.jgroups.blocks.RpcDispatcher.Marshaller2 |
---|
objectFromByteBuffer |
Methods inherited from interface org.jgroups.blocks.RpcDispatcher.Marshaller |
---|
objectFromByteBuffer, objectToByteBuffer |
Method Detail |
---|
void objectToObjectStream(Object obj, ObjectOutputStream out) throws Exception
ObjectOutputStream
obj
- object to marshallout
- stream to marshall to
Exception
Object objectFromObjectStream(ObjectInputStream in) throws Exception
ObjectInputStream
in
- stream to unmarshall from
Exception
Object objectFromStream(InputStream is) throws Exception
InputStream
is
- stream to unmarshall from
Exception
void objectToObjectStream(Object obj, ObjectOutputStream out, Fqn region) throws Exception
objectToObjectStream(Object,java.io.ObjectOutputStream)
which adds a hint to the Fqn
region
obj
- object to marshallregion
- fqn that this object pertains toout
- stream to marshall to
Exception
RegionalizedMethodCall regionalizedMethodCallFromByteBuffer(byte[] buffer) throws Exception
RpcDispatcher.Marshaller.objectFromByteBuffer(byte[])
buffer
- byte buffer
Exception
- if there are issuesRegionalizedMethodCall regionalizedMethodCallFromObjectStream(ObjectInputStream in) throws Exception
objectFromObjectStream(java.io.ObjectInputStream)
in
- object inout stream
Exception
- if there are issuesByteBuffer objectToBuffer(Object o) throws Exception
RpcDispatcher.Marshaller2.objectToBuffer(Object)
that returns an instance
of ByteBuffer
instead of Buffer
.
objectToBuffer
in interface org.jgroups.blocks.RpcDispatcher.Marshaller2
o
- object to marshall
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |