Class JdkMarshaller

  • All Implemented Interfaces:
    Marshaller

    public class JdkMarshaller
    extends AbstractNodeNameAwareMarshaller
    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 binary marshaller - see IgniteBinary.
     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

    • Constructor Detail

      • JdkMarshaller

        public JdkMarshaller()
        Default constructor. Use this constructor with caution. It creates a JdkMarshaller instance that has class filtering DISABLED. Therefore, if it will be used on the server side to unmarshal user data received from the network, it may lead to security breaches.
      • JdkMarshaller

        public JdkMarshaller​(IgnitePredicate<String> clsFilter)
        Parameters:
        clsFilter - Class name filter.
    • Method Detail

      • unmarshal0

        protected <T> T unmarshal0​(InputStream in,
                                   @Nullable
                                   @Nullable ClassLoader clsLdr)
                            throws IgniteCheckedException
        Unmarshals object from the input stream using given class loader. This method should not close given input stream.
        Specified by:
        unmarshal0 in class AbstractNodeNameAwareMarshaller
        Type Parameters:
        T - Type of unmarshalled object.
        Parameters:
        in - Input stream.
        clsLdr - If not null then given class loader will be used for unmarshal object.
        Returns:
        Unmarshalled object.
        Throws:
        IgniteCheckedException - If unmarshalling failed.
      • unmarshal0

        protected <T> T unmarshal0​(byte[] arr,
                                   @Nullable
                                   @Nullable ClassLoader clsLdr)
                            throws IgniteCheckedException
        Unmarshals object from byte array using given class loader.
        Specified by:
        unmarshal0 in class AbstractNodeNameAwareMarshaller
        Type Parameters:
        T - Type of unmarshalled object.
        Parameters:
        arr - Byte array.
        clsLdr - If not null then given class loader will be used for unmarshal object.
        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.