org.jboss.cache.marshall
Class CacheMarshaller200

java.lang.Object
  extended by org.jboss.cache.marshall.AbstractMarshaller
      extended by org.jboss.cache.marshall.CacheMarshaller200
All Implemented Interfaces:
Marshaller, org.jgroups.blocks.RpcDispatcher.Marshaller, org.jgroups.blocks.RpcDispatcher.Marshaller2
Direct Known Subclasses:
CacheMarshaller210

public class CacheMarshaller200
extends AbstractMarshaller

An enhanced marshaller for RPC calls between CacheImpl instances.

Author:
Manik Surtani (manik AT jboss DOT org)

Field Summary
protected  CommandsFactory commandsFactory
           
protected static InactiveRegionException IRE
           
protected static int MAGICNUMBER_ARRAY
           
protected static int MAGICNUMBER_ARRAY_LIST
           
protected static int MAGICNUMBER_BOOLEAN
           
protected static int MAGICNUMBER_BYTE
           
protected static int MAGICNUMBER_CHAR
           
protected static int MAGICNUMBER_DEFAULT_DATA_VERSION
           
protected static int MAGICNUMBER_DOUBLE
           
protected static int MAGICNUMBER_EXTENDED_RESPONSE
           
protected static int MAGICNUMBER_FASTCOPY_HASHMAP
           
protected static int MAGICNUMBER_FLOAT
           
protected static int MAGICNUMBER_FQN
           
protected static int MAGICNUMBER_GRAVITATERESULT
           
protected static int MAGICNUMBER_GTX
           
protected static int MAGICNUMBER_HASH_MAP
           
protected static int MAGICNUMBER_HASH_SET
           
protected static int MAGICNUMBER_IMMUTABLE_MAPCOPY
           
protected static int MAGICNUMBER_INTEGER
           
protected static int MAGICNUMBER_IPADDRESS
           
protected static int MAGICNUMBER_LINKED_LIST
           
protected static int MAGICNUMBER_LONG
           
protected static int MAGICNUMBER_MARSHALLEDVALUE
           
protected static int MAGICNUMBER_METHODCALL
           
protected static int MAGICNUMBER_NODEDATA
           
protected static int MAGICNUMBER_NODEDATA_EXCEPTION_MARKER
           
protected static int MAGICNUMBER_NODEDATA_MARKER
           
protected static int MAGICNUMBER_NULL
           
protected static int MAGICNUMBER_OBJECT
           
protected static int MAGICNUMBER_REF
           
protected static int MAGICNUMBER_REQUEST_IGNORED_RESPONSE
           
protected static int MAGICNUMBER_SERIALIZABLE
           
protected static int MAGICNUMBER_SHORT
           
protected static int MAGICNUMBER_STRING
           
protected static int MAGICNUMBER_TREE_MAP
           
protected static int MAGICNUMBER_TREE_SET
           
protected static int MAGICNUMBER_TXLOG_ENTRY
           
 
Fields inherited from class org.jboss.cache.marshall.AbstractMarshaller
configuration, defaultClassLoader, defaultInactive, log, regionManager, trace, useRefs, useRegionBasedMarshalling
 
Constructor Summary
CacheMarshaller200()
           
 
Method Summary
 void injectCommandsFactory(CommandsFactory commandsFactory)
           
protected  void marshallDefaultDataVersion(DefaultDataVersion ddv, ObjectOutputStream out)
           
protected  void marshallFqn(Fqn fqn, ObjectOutputStream out, Map<Object,Integer> refMap)
           
protected  void marshallObject(Object o, ObjectOutputStream out, Map<Object,Integer> refMap)
           
protected  void marshallString(String s, ObjectOutputStream out)
           
 Object objectFromObjectStream(ObjectInputStream in)
          Unmarshalls an object from an ObjectInputStream
protected  Object[] objectFromObjectStreamRegionBased(ObjectInputStream in)
           
 void objectToObjectStream(Object o, ObjectOutputStream out)
          Marshalls an object to a given ObjectOutputStream
 void objectToObjectStream(Object o, ObjectOutputStream out, Fqn region)
          Overloaded form of Marshaller.objectToObjectStream(Object,java.io.ObjectOutputStream) which adds a hint to the Fqn region
protected  int readReference(ObjectInputStream in)
          Reads a reference from a given stream.
protected  int readUnsignedInt(ObjectInputStream in)
           
protected  long readUnsignedLong(ObjectInputStream in)
           
 RegionalizedMethodCall regionalizedMethodCallFromObjectStream(ObjectInputStream in)
          Returns a RegionalizedMethodCall from an object input stream.
protected  Object unmarshallArray(ObjectInputStream in, UnmarshalledReferences refs)
           
protected  DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in)
           
protected  Fqn unmarshallFqn(ObjectInputStream in, UnmarshalledReferences refMap)
           
protected  Object unmarshallObject(ObjectInputStream in, ClassLoader loader, UnmarshalledReferences refMap, boolean overrideContextClassloaderOnThread)
           
protected  Object unmarshallObject(ObjectInputStream in, UnmarshalledReferences refMap)
           
protected  String unmarshallString(ObjectInputStream in)
           
protected  void writeReference(ObjectOutputStream out, int reference)
          Writes a reference to a given object output stream.
protected  void writeUnsignedInt(ObjectOutputStream out, int i)
           
protected  void writeUnsignedLong(ObjectOutputStream out, long i)
           
 
Methods inherited from class org.jboss.cache.marshall.AbstractMarshaller
extractFqn, init, initLogger, objectFromByteBuffer, objectFromByteBuffer, objectFromStream, objectToBuffer, objectToByteBuffer, regionalizedMethodCallFromByteBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAGICNUMBER_METHODCALL

protected static final int MAGICNUMBER_METHODCALL
See Also:
Constant Field Values

MAGICNUMBER_FQN

protected static final int MAGICNUMBER_FQN
See Also:
Constant Field Values

MAGICNUMBER_GTX

protected static final int MAGICNUMBER_GTX
See Also:
Constant Field Values

MAGICNUMBER_IPADDRESS

protected static final int MAGICNUMBER_IPADDRESS
See Also:
Constant Field Values

MAGICNUMBER_ARRAY_LIST

protected static final int MAGICNUMBER_ARRAY_LIST
See Also:
Constant Field Values

MAGICNUMBER_INTEGER

protected static final int MAGICNUMBER_INTEGER
See Also:
Constant Field Values

MAGICNUMBER_LONG

protected static final int MAGICNUMBER_LONG
See Also:
Constant Field Values

MAGICNUMBER_BOOLEAN

protected static final int MAGICNUMBER_BOOLEAN
See Also:
Constant Field Values

MAGICNUMBER_STRING

protected static final int MAGICNUMBER_STRING
See Also:
Constant Field Values

MAGICNUMBER_DEFAULT_DATA_VERSION

protected static final int MAGICNUMBER_DEFAULT_DATA_VERSION
See Also:
Constant Field Values

MAGICNUMBER_LINKED_LIST

protected static final int MAGICNUMBER_LINKED_LIST
See Also:
Constant Field Values

MAGICNUMBER_HASH_MAP

protected static final int MAGICNUMBER_HASH_MAP
See Also:
Constant Field Values

MAGICNUMBER_TREE_MAP

protected static final int MAGICNUMBER_TREE_MAP
See Also:
Constant Field Values

MAGICNUMBER_HASH_SET

protected static final int MAGICNUMBER_HASH_SET
See Also:
Constant Field Values

MAGICNUMBER_TREE_SET

protected static final int MAGICNUMBER_TREE_SET
See Also:
Constant Field Values

MAGICNUMBER_NODEDATA_MARKER

protected static final int MAGICNUMBER_NODEDATA_MARKER
See Also:
Constant Field Values

MAGICNUMBER_NODEDATA_EXCEPTION_MARKER

protected static final int MAGICNUMBER_NODEDATA_EXCEPTION_MARKER
See Also:
Constant Field Values

MAGICNUMBER_NODEDATA

protected static final int MAGICNUMBER_NODEDATA
See Also:
Constant Field Values

MAGICNUMBER_GRAVITATERESULT

protected static final int MAGICNUMBER_GRAVITATERESULT
See Also:
Constant Field Values

MAGICNUMBER_SHORT

protected static final int MAGICNUMBER_SHORT
See Also:
Constant Field Values

MAGICNUMBER_IMMUTABLE_MAPCOPY

protected static final int MAGICNUMBER_IMMUTABLE_MAPCOPY
See Also:
Constant Field Values

MAGICNUMBER_MARSHALLEDVALUE

protected static final int MAGICNUMBER_MARSHALLEDVALUE
See Also:
Constant Field Values

MAGICNUMBER_FASTCOPY_HASHMAP

protected static final int MAGICNUMBER_FASTCOPY_HASHMAP
See Also:
Constant Field Values

MAGICNUMBER_ARRAY

protected static final int MAGICNUMBER_ARRAY
See Also:
Constant Field Values

MAGICNUMBER_BYTE

protected static final int MAGICNUMBER_BYTE
See Also:
Constant Field Values

MAGICNUMBER_CHAR

protected static final int MAGICNUMBER_CHAR
See Also:
Constant Field Values

MAGICNUMBER_FLOAT

protected static final int MAGICNUMBER_FLOAT
See Also:
Constant Field Values

MAGICNUMBER_DOUBLE

protected static final int MAGICNUMBER_DOUBLE
See Also:
Constant Field Values

MAGICNUMBER_OBJECT

protected static final int MAGICNUMBER_OBJECT
See Also:
Constant Field Values

MAGICNUMBER_TXLOG_ENTRY

protected static final int MAGICNUMBER_TXLOG_ENTRY
See Also:
Constant Field Values

MAGICNUMBER_REQUEST_IGNORED_RESPONSE

protected static final int MAGICNUMBER_REQUEST_IGNORED_RESPONSE
See Also:
Constant Field Values

MAGICNUMBER_EXTENDED_RESPONSE

protected static final int MAGICNUMBER_EXTENDED_RESPONSE
See Also:
Constant Field Values

MAGICNUMBER_NULL

protected static final int MAGICNUMBER_NULL
See Also:
Constant Field Values

MAGICNUMBER_SERIALIZABLE

protected static final int MAGICNUMBER_SERIALIZABLE
See Also:
Constant Field Values

MAGICNUMBER_REF

protected static final int MAGICNUMBER_REF
See Also:
Constant Field Values

IRE

protected static final InactiveRegionException IRE

commandsFactory

protected CommandsFactory commandsFactory
Constructor Detail

CacheMarshaller200

public CacheMarshaller200()
Method Detail

injectCommandsFactory

public void injectCommandsFactory(CommandsFactory commandsFactory)

objectToObjectStream

public void objectToObjectStream(Object o,
                                 ObjectOutputStream out)
                          throws Exception
Description copied from interface: Marshaller
Marshalls an object to a given ObjectOutputStream

Parameters:
o - object to marshall
out - stream to marshall to
Throws:
Exception

regionalizedMethodCallFromObjectStream

public RegionalizedMethodCall regionalizedMethodCallFromObjectStream(ObjectInputStream in)
                                                              throws Exception
Description copied from interface: Marshaller
Returns a RegionalizedMethodCall from an object input stream. Only use if you know that the byte buffer contains a MethodCall and that you are using region-based marshalling, otherwise use Marshaller.objectFromObjectStream(java.io.ObjectInputStream)

Specified by:
regionalizedMethodCallFromObjectStream in interface Marshaller
Overrides:
regionalizedMethodCallFromObjectStream in class AbstractMarshaller
Parameters:
in - object inout stream
Returns:
a RegionalizedMethodCall
Throws:
Exception - if there are issues

objectFromObjectStream

public Object objectFromObjectStream(ObjectInputStream in)
                              throws Exception
Description copied from interface: Marshaller
Unmarshalls an object from an ObjectInputStream

Parameters:
in - stream to unmarshall from
Throws:
Exception

objectToObjectStream

public void objectToObjectStream(Object o,
                                 ObjectOutputStream out,
                                 Fqn region)
                          throws Exception
Description copied from interface: Marshaller
Overloaded form of Marshaller.objectToObjectStream(Object,java.io.ObjectOutputStream) which adds a hint to the Fqn region

Parameters:
o - object to marshall
out - stream to marshall to
region - fqn that this object pertains to
Throws:
Exception

objectFromObjectStreamRegionBased

protected Object[] objectFromObjectStreamRegionBased(ObjectInputStream in)
                                              throws Exception
Parameters:
in -
Returns:
a 2-object array. The first one is the unmarshalled object and the 2nd is an Fqn that relates to the region used. If region-based marshalling is not used, the 2nd value is null.
Throws:
Exception

marshallObject

protected void marshallObject(Object o,
                              ObjectOutputStream out,
                              Map<Object,Integer> refMap)
                       throws Exception
Throws:
Exception

marshallString

protected void marshallString(String s,
                              ObjectOutputStream out)
                       throws Exception
Throws:
Exception

marshallFqn

protected void marshallFqn(Fqn fqn,
                           ObjectOutputStream out,
                           Map<Object,Integer> refMap)
                    throws Exception
Throws:
Exception

unmarshallObject

protected Object unmarshallObject(ObjectInputStream in,
                                  ClassLoader loader,
                                  UnmarshalledReferences refMap,
                                  boolean overrideContextClassloaderOnThread)
                           throws Exception
Throws:
Exception

unmarshallObject

protected Object unmarshallObject(ObjectInputStream in,
                                  UnmarshalledReferences refMap)
                           throws Exception
Throws:
Exception

unmarshallString

protected String unmarshallString(ObjectInputStream in)
                           throws Exception
Throws:
Exception

unmarshallFqn

protected Fqn unmarshallFqn(ObjectInputStream in,
                            UnmarshalledReferences refMap)
                     throws Exception
Throws:
Exception

marshallDefaultDataVersion

protected void marshallDefaultDataVersion(DefaultDataVersion ddv,
                                          ObjectOutputStream out)
                                   throws Exception
Throws:
Exception

unmarshallDefaultDataVersion

protected DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in)
                                                   throws Exception
Throws:
Exception

readReference

protected int readReference(ObjectInputStream in)
                     throws IOException
Reads a reference from a given stream.

Parameters:
in - the stream to read from
Returns:
an int representing a reference in RefMap.
Throws:
IOException - propagated from the OIS

writeReference

protected void writeReference(ObjectOutputStream out,
                              int reference)
                       throws IOException
Writes a reference to a given object output stream.

Parameters:
out - the stream to write to
reference - the reference to write
Throws:
IOException - propagated from the OOS

readUnsignedInt

protected int readUnsignedInt(ObjectInputStream in)
                       throws IOException
Throws:
IOException

writeUnsignedInt

protected void writeUnsignedInt(ObjectOutputStream out,
                                int i)
                         throws IOException
Throws:
IOException

readUnsignedLong

protected long readUnsignedLong(ObjectInputStream in)
                         throws IOException
Throws:
IOException

writeUnsignedLong

protected void writeUnsignedLong(ObjectOutputStream out,
                                 long i)
                          throws IOException
Throws:
IOException

unmarshallArray

protected Object unmarshallArray(ObjectInputStream in,
                                 UnmarshalledReferences refs)
                          throws Exception
Throws:
Exception


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.