|
||||||||||
| 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.jboss.AbstractJBossMarshaller
public abstract class AbstractJBossMarshaller
Common parent for both embedded and standalone JBoss Marshalling-based marshallers.
| Nested Class Summary | |
|---|---|
protected static class |
AbstractJBossMarshaller.DebuggingExceptionListener
|
| Field Summary | |
|---|---|
protected org.jboss.marshalling.MarshallingConfiguration |
baseCfg
|
protected static int |
DEF_CLASS_COUNT
|
protected static int |
DEF_INSTANCE_COUNT
|
protected static JBossMarshallerFactory |
factory
|
protected static org.jboss.logging.BasicLogger |
log
|
protected static boolean |
trace
|
| Fields inherited from class org.infinispan.marshall.AbstractMarshaller |
|---|
marshallableTypeHints |
| Constructor Summary | |
|---|---|
AbstractJBossMarshaller()
|
|
| Method Summary | |
|---|---|
void |
finishObjectInput(ObjectInput oi)
Finish using the given ObjectInput. |
void |
finishObjectOutput(ObjectOutput oo)
Finish using the given ObjectOutput. |
boolean |
isMarshallable(Object o)
A method that checks whether the given object is marshallable as per the rules of this marshaller. |
protected boolean |
isMarshallableCandidate(Object o)
|
Object |
objectFromByteBuffer(byte[] buf,
int offset,
int length)
Unmarshalls an object from a specific portion of a byte array. |
Object |
objectFromObjectStream(ObjectInput in)
Unmarshalls an object from an ObjectInput |
protected ByteBuffer |
objectToBuffer(Object o,
int estimatedSize)
This is a convenience method for converting an object into a ByteBuffer which takes
an estimated size as parameter. |
void |
objectToObjectStream(Object obj,
ObjectOutput out)
Marshalls an object to a given ObjectOutput |
ObjectInput |
startObjectInput(InputStream is,
boolean isReentrant)
Create and open a new ObjectInput for the given input stream. |
ObjectOutput |
startObjectOutput(OutputStream os,
boolean isReentrant)
Use StreamingMarshaller.startObjectOutput(OutputStream, boolean, int) instead |
ObjectOutput |
startObjectOutput(OutputStream os,
boolean isReentrant,
int estimatedSize)
Create and open an ObjectOutput instance for the given output stream. |
void |
stop()
Stop the marshaller. |
| Methods inherited from class org.infinispan.marshall.AbstractMarshaller |
|---|
getBufferSizePredictor, objectFromByteBuffer, objectFromInputStream, objectToBuffer, objectToByteBuffer, objectToByteBuffer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.infinispan.marshall.StreamingMarshaller |
|---|
objectFromInputStream |
| Methods inherited from interface org.infinispan.marshall.Marshaller |
|---|
getBufferSizePredictor, objectFromByteBuffer, objectToBuffer, objectToByteBuffer, objectToByteBuffer |
| Field Detail |
|---|
protected static final org.jboss.logging.BasicLogger log
protected static final boolean trace
protected static final JBossMarshallerFactory factory
protected static final int DEF_INSTANCE_COUNT
protected static final int DEF_CLASS_COUNT
protected final org.jboss.marshalling.MarshallingConfiguration baseCfg
| Constructor Detail |
|---|
public AbstractJBossMarshaller()
| Method Detail |
|---|
public final void objectToObjectStream(Object obj,
ObjectOutput out)
throws IOException
StreamingMarshallerObjectOutput
objectToObjectStream in interface StreamingMarshallerobj - object to marshallout - stream to marshall to
IOException
protected final ByteBuffer objectToBuffer(Object o,
int estimatedSize)
throws IOException
AbstractMarshallerByteBuffer which takes
an estimated size as parameter. A ByteBuffer allows direct access to the byte
array with minimal array copying
objectToBuffer in class AbstractMarshallero - object to marshallestimatedSize - an estimate of how large the resulting byte array may be
IOException
public final ObjectOutput startObjectOutput(OutputStream os,
boolean isReentrant,
int estimatedSize)
throws IOException
StreamingMarshallerCreate 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 StreamingMarshaller 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 StreamingMarshaller 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 across.
This enables storing as binary on the receiver side which is performance gain. The StreamingMarshaller 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.
startObjectOutput in interface StreamingMarshalleros - output streamisReentrant - whether the call is reentrant or not.estimatedSize - estimated size in bytes of the output. Only meant as a possible performance optimization.
IOException
public final ObjectOutput startObjectOutput(OutputStream os,
boolean isReentrant)
throws IOException
StreamingMarshallerStreamingMarshaller.startObjectOutput(OutputStream, boolean, int) instead
startObjectOutput in interface StreamingMarshallerIOExceptionpublic final void finishObjectOutput(ObjectOutput oo)
StreamingMarshaller
finishObjectOutput in interface StreamingMarshalleroo - data output that finished using
public final Object objectFromByteBuffer(byte[] buf,
int offset,
int length)
throws IOException,
ClassNotFoundException
Marshaller
objectFromByteBuffer in interface Marshallerbuf - byte array containing the binary representation of an object. Must not be null.offset - point in buffer to start readinglength - number of bytes to consider
IOException - if unmarshalling cannot complete due to some I/O error
ClassNotFoundException - if the class of the object trying to unmarshall is unknown
public final ObjectInput startObjectInput(InputStream is,
boolean isReentrant)
throws IOException
StreamingMarshallerCreate 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 StreamingMarshaller implementation could potentially use some mechanisms to speed up this startObjectInput call.
startObjectInput in interface StreamingMarshalleris - input streamisReentrant - whether the call is reentrant or not.
IOException
public final Object objectFromObjectStream(ObjectInput in)
throws IOException,
ClassNotFoundException
StreamingMarshallerObjectInput
objectFromObjectStream in interface StreamingMarshallerin - stream to unmarshall from
IOException - if unmarshalling cannot complete due to some I/O error
ClassNotFoundException - if the class of the object trying to unmarshall is unknownpublic final void finishObjectInput(ObjectInput oi)
StreamingMarshaller
finishObjectInput in interface StreamingMarshalleroi - data input that finished using
public boolean isMarshallable(Object o)
throws Exception
Marshaller
isMarshallable in interface Marshallero - object to verify whether it's marshallable or not
Exception - if while checking whether the object was serializable or not, an exception arosepublic void stop()
StreamingMarshaller
stop in interface StreamingMarshallerprotected boolean isMarshallableCandidate(Object o)
|
--> | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||