public class GridJdkMarshaller extends GridAbstractMarshaller
GridMarshaller based on JDK serialization mechanism.
GridJdkMarshaller needs to be explicitly configured to override default GridOptimizedMarshaller.
GridJdkMarshaller marshaller = new GridJdkMarshaller(); GridConfiguration cfg = new GridConfiguration(); // Override default marshaller. cfg.setMarshaller(marshaller); // Starts grid. G.start(cfg);
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfiguration" singleton="true">
...
<property name="marshaller">
<bean class="org.gridgain.grid.marshaller.jdk.GridJdkMarshaller"/>
</property>
...
</bean>
For information about Spring framework visit www.springframework.org
public class MyGridJob implements GridComputeJob {
...
@GridMarshallerResource
private GridMarshaller marshaller;
...
}
or
public class MyGridJob implements GridComputeJob {
...
private GridMarshaller marshaller;
...
@GridMarshallerResource
public void setMarshaller(GridMarshaller marshaller) {
this.marshaller = marshaller;
}
...
}
DFLT_BUFFER_SIZE| Constructor and Description |
|---|
GridJdkMarshaller() |
| Modifier and Type | Method and Description |
|---|---|
void |
marshal(Object obj,
OutputStream out)
Marshals object to the output stream.
|
String |
toString() |
<T> T |
unmarshal(InputStream in,
ClassLoader clsLdr)
Unmarshals object from the output stream using given class loader.
|
marshal, unmarshalpublic void marshal(@Nullable Object obj, OutputStream out) throws GridException
obj - Object to marshal.out - Output stream to marshal into.GridException - If marshalling failed.public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws GridException
T - Type of unmarshalled object.in - Input stream.clsLdr - Class loader to use.GridException - If unmarshalling failed.Copyright © 2014. All rights reserved.