|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.marshall.AbstractMarshaller
org.infinispan.marshall.VersionAwareMarshaller
public class VersionAwareMarshaller
A delegate to various other marshallers like JBossMarshaller
. This delegating marshaller adds versioning
information to the stream when marshalling objects and is able to pick the appropriate marshaller to delegate to
based on the versioning information when unmarshalling objects.
Constructor Summary | |
---|---|
VersionAwareMarshaller()
|
Method Summary | |
---|---|
void |
finishObjectInput(ObjectInput oi)
Finish using the given ObjectInput. |
void |
finishObjectOutput(ObjectOutput oo)
Finish using the given ObjectOutput. |
protected int |
getCustomMarshallerVersionInt()
|
void |
inject(ClassLoader loader,
RemoteCommandsFactory remoteCommandsFactory)
|
Object |
objectFromByteBuffer(byte[] buf)
|
Object |
objectFromByteBuffer(byte[] bytes,
int offset,
int len)
|
Object |
objectFromObjectStream(ObjectInput in)
Unmarshalls an object from an ObjectInput |
ByteBuffer |
objectToBuffer(Object obj)
A method that returns an instance of ByteBuffer , which allows direct access to the byte
array with minimal array copying |
byte[] |
objectToByteBuffer(Object obj)
|
void |
objectToObjectStream(Object obj,
ObjectOutput out)
Marshalls an object to a given ObjectOutput |
void |
start()
|
ObjectInput |
startObjectInput(InputStream is,
boolean isReentrant)
Create and open a new ObjectInput for the given input stream. |
ObjectOutput |
startObjectOutput(OutputStream os,
boolean isReentrant)
Create and open an ObjectOutput instance for the given output stream. |
void |
stop()
|
Methods inherited from class org.infinispan.marshall.AbstractMarshaller |
---|
objectFromInputStream |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VersionAwareMarshaller()
Method Detail |
---|
public void inject(ClassLoader loader, RemoteCommandsFactory remoteCommandsFactory)
public void start()
public void stop()
protected int getCustomMarshallerVersionInt()
public ByteBuffer objectToBuffer(Object obj) throws IOException
Marshaller
ByteBuffer
, which allows direct access to the byte
array with minimal array copying
obj
- object to marshall
IOException
public Object objectFromByteBuffer(byte[] bytes, int offset, int len) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public ObjectOutput startObjectOutput(OutputStream os, boolean isReentrant) throws IOException
Marshaller
Create and open an ObjectOutput instance for the given output stream. This method should be used for opening data outputs when multiple objectToObjectStream() calls will be made before the stream is closed by calling finishObjectOutput().
This method also takes a boolean that represents whether this particular call to startObjectOutput() is reentrant or not. A call to startObjectOutput() should be marked reentrant whenever a 2nd or more calls to this method are made without having called finishObjectOutput() first.
To potentially speed up calling startObjectOutput multiple times in a non-reentrant way, i.e. startObjectOutput/finishObjectOutput...startObjectOutput/finishObjectOutput...etc, which is is the most common case, the Marshaller implementation could potentially use some mechanisms to speed up this startObjectOutput call.
On the other hand, when a call is reentrant, i.e. startObjectOutput/startObjectOutput(reentrant)...finishObjectOutput/finishObjectOutput,
the Marshaller implementation might treat it differently. An example of reentrancy would be marshalling of MarshalledValue
.
When sending or storing a MarshalledValue, a call to startObjectOutput() would occur so that the stream is open and
following, a 2nd call could occur so that MarshalledValue's raw byte array version is calculated and sent accross.
This enables lazy deserialization on the receiver side which is performance gain. The Marshaller implementation could decide
that it needs a separate ObjectOutput or similar for the 2nd call since it's aim is only to get the raw byte array version
and the close finish with it.
os
- output streamisReentrant
- whether the call is reentrant or not.
IOException
public void finishObjectOutput(ObjectOutput oo)
Marshaller
oo
- data output that finished usingpublic void objectToObjectStream(Object obj, ObjectOutput out) throws IOException
Marshaller
ObjectOutput
obj
- object to marshallout
- stream to marshall to
IOException
public ObjectInput startObjectInput(InputStream is, boolean isReentrant) throws IOException
Marshaller
Create and open a new ObjectInput for the given input stream. This method should be used for opening data inputs when multiple objectFromObjectStream() calls will be made before the stream is closed.
This method also takes a boolean that represents whether this particular call to startObjectInput() is reentrant or not. A call to startObjectInput() should be marked reentrant whenever a 2nd or more calls to this method are made without having called finishObjectInput() first.
To potentially speed up calling startObjectInput multiple times in a non-reentrant way, i.e. startObjectInput/finishObjectInput...startObjectInput/finishObjectInput...etc, which is is the most common case, the Marshaller implementation could potentially use some mechanisms to speed up this startObjectInput call.
is
- input streamisReentrant
- whether the call is reentrant or not.
IOException
public void finishObjectInput(ObjectInput oi)
Marshaller
oi
- data input that finished usingpublic Object objectFromObjectStream(ObjectInput in) throws IOException, ClassNotFoundException
Marshaller
ObjectInput
in
- stream to unmarshall from
IOException
ClassNotFoundException
public byte[] objectToByteBuffer(Object obj) throws IOException
IOException
public Object objectFromByteBuffer(byte[] buf) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
|
Google Analytics | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |