Class OptimizedMarshallerImpl

  • All Implemented Interfaces:
    OptimizedMarshaller, Marshaller

    public class OptimizedMarshallerImpl
    extends AbstractNodeNameAwareMarshaller
    implements OptimizedMarshaller
    Optimized implementation of Marshaller. Unlike JdkMarshaller, which is based on standard ObjectOutputStream, this marshaller does not enforce that all serialized objects implement Serializable interface. It is also about 20 times faster as it removes lots of serialization overhead that exists in default JDK implementation.

    OptimizedMarshaller is tested only on Java HotSpot VM on other VMs it could yield unexpected results. It is the default marshaller on Java HotSpot VMs and will be used if no other marshaller was explicitly configured.

    Configuration

    Mandatory

    This marshaller has no mandatory configuration parameters.

    Java Example

     OptimizedMarshaller marshaller = new OptimizedMarshaller();
    
     // Enforce Serializable interface.
     marshaller.setRequireSerializable(true);
    
     IgniteConfiguration cfg = new IgniteConfiguration();
    
     // Override marshaller.
     cfg.setMarshaller(marshaller);
    
     // Starts grid.
     G.start(cfg);
     

    Spring Example

    GridOptimizedMarshaller 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="OptimizedMarshaller">
                 <property name="requireSerializable">true</property>
             </bean>
         </property>
         ...
     </bean>
     


    For information about Spring framework visit www.springframework.org