GridGain™ 2.1.0
Java API Specification

org.gridgain.grid.marshaller.jboss
Class GridJBossMarshaller

java.lang.Object
  extended by org.gridgain.grid.marshaller.jboss.GridJBossMarshaller
All Implemented Interfaces:
GridMarshaller

public class GridJBossMarshaller
extends Object
implements GridMarshaller

Implementation of GridMarshaller based on JBoss serialization.

Note, GridJBossMarshaller marshal and unmarshal objects except objects with types defined in GridMarshaller.EXCLUDED_GRID_CLASSES

Configuration

Mandatory

This marshaller has no mandatory configuration parameters.

Java Example

GridJBossMarshaller is used by default but it can be explicitely configured.
 GridJBossMarshaller marshaller = new GridJBossMarshaller();

 GridConfigurationAdapter cfg = new GridConfigurationAdapter();

 // Override marshaller.
 cfg.setMarshaller(marshaller);

 // Start grid.
 GridFactory.start(cfg);
 

Spring Example

GridJBossMarshaller can be configured from Spring XML configuration file:
 <bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
     ...
     <property name="marshaller">
         <bean class="org.gridgain.grid.marshaller.jboss.GridJBossMarshaller"/>
     </property>
     ...
 </bean>
 


For information about Spring framework visit www.springframework.org

Injection Example

GridJBossMarshaller can be injected in users task, job or SPI as following:
 public class MyGridJob implements GridJob {
     ...
     @GridMarshallerResource
     private GridMarshaller marshaller = null;
     ...
 }
 
or
 public class MyGridJob implements GridJob {
     ...
     private GridMarshaller marshaller = null;
     ...
     @GridMarshallerResource
     public void setMarshaller(GridMarshaller marshaller) {
         this.marshaller = marshaller;
     }
     ...
 }
 




See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

Author:   2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0

 

Field Summary
 
Fields inherited from interface org.gridgain.grid.marshaller.GridMarshaller
EXCLUDED_GRID_CLASSES
 
Constructor Summary
GridJBossMarshaller()
           
 
Method Summary
 void marshal(Object obj, OutputStream out)
          Marshals object to the output stream.
 String toString()
          
<T> T
unmarshal(InputStream in, ClassLoader clsLoader)
          Unmarshals object from the output stream using given class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridJBossMarshaller

public GridJBossMarshaller()
Method Detail

marshal

public void marshal(Object obj,
                    OutputStream out)
             throws GridException
Marshals object to the output stream. This method should not close given output stream.

Specified by:
marshal in interface GridMarshaller
Throws:
GridException - If marshalling failed.
Parameters:
obj - Object to marshal.
out - Output stream to marshal into.

unmarshal

public <T> T unmarshal(InputStream in,
                       ClassLoader clsLoader)
            throws GridException
Unmarshals object from the output stream using given class loader. This method should not close given input stream.

Specified by:
unmarshal in interface GridMarshaller
Throws:
GridException - If unmarshalling failed.
Type Parameters:
T - Type of unmarshalled object.
Parameters:
in - Input stream.
clsLoader - Class loader to use.
Returns:
Unmarshalled object.

toString

public String toString()

Overrides:
toString in class Object

GridGain™ 2.1.0
Java API Specification

GridGain™ - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved.