org.apache.ignite.marshaller.jdk

## Class JdkMarshaller

- java.lang.Object
- - org.apache.ignite.marshaller.AbstractMarshaller
  - - org.apache.ignite.marshaller.jdk.JdkMarshaller

All Implemented Interfaces:
  Marshaller

    public class JdkMarshaller
    extends AbstractMarshaller

Implementation of `Marshaller` based on JDK serialization mechanism.

# Configuration

## Mandatory

This marshaller has no mandatory configuration parameters.

## Java Example

`JdkMarshaller` needs to be explicitly configured to override default `OptimizedMarshaller`.

     JdkMarshaller marshaller = new JdkMarshaller();

     IgniteConfiguration cfg = new IgniteConfiguration();

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

     // Starts grid.
     G.start(cfg);

## Spring Example

JdkMarshaller can be configured from Spring XML configuration file:

     <bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true">
         ...
         <property name="marshaller">
             <bean class="org.apache.ignite.marshaller.jdk.JdkMarshaller"/>
         </property>
         ...
     </bean>

For information about Spring framework visit www.springframework.org

### Field Summary

### Fields inherited from class org.apache.ignite.marshaller.AbstractMarshaller

`ctx, DFLT_BUFFER_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`JdkMarshaller()`

### Method Summary

Methods
`void` `marshal(Object obj, OutputStream out)` Marshals object to the output stream.
`void` `onUndeploy(ClassLoader ldr)` Undeployment callback invoked when class loader is being undeployed.
`String` `toString()`
`<T> T` `unmarshal(InputStream in, ClassLoader clsLdr)` Unmarshals object from the input stream using given class loader.

### Methods inherited from class org.apache.ignite.marshaller.AbstractMarshaller

`marshal, setContext, unmarshal`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### JdkMarshaller

    public JdkMarshaller()

### Method Detail

#### marshal

    public void marshal(@Nullable
               Object obj,
               OutputStream out)
                 throws IgniteCheckedException

Marshals object to the output stream. This method should not close given output stream.

Parameters:
  `obj` - Object to marshal.
  `out` - Output stream to marshal into.
Throws:
  `IgniteCheckedException` - If marshalling failed.

#### unmarshal

    public <T> T unmarshal(InputStream in,
                  @Nullable
                  ClassLoader clsLdr)
                throws IgniteCheckedException

Unmarshals object from the input stream using given class loader. This method should not close given input stream.

Type Parameters:
  `T` - Type of unmarshalled object.
Parameters:
  `in` - Input stream.
  `clsLdr` - Class loader to use.
Returns:
  Unmarshalled object.
Throws:
  `IgniteCheckedException` - If unmarshalling failed.

#### onUndeploy

    public void onUndeploy(ClassLoader ldr)

Undeployment callback invoked when class loader is being undeployed. Some marshallers may want to clean their internal state that uses the undeployed class loader somehow.

Specified by:
  `onUndeploy` in class `AbstractMarshaller`
Parameters:
  `ldr` - Class loader being undeployed.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.6.0
Release Date | : May 18 2016