Class AbstractKryoStateMachineSerialisationService<S,E>

java.lang.Object
org.springframework.statemachine.kryo.AbstractKryoStateMachineSerialisationService<S,E>
Type Parameters:
S - the type of state
E - the type of event
All Implemented Interfaces:
StateMachineSerialisationService<S,E>
Direct Known Subclasses:
KryoStateMachineSerialisationService

public abstract class AbstractKryoStateMachineSerialisationService<S,E> extends Object implements StateMachineSerialisationService<S,E>
Abstract base implementation for StateMachineSerialisationService using kryo.
  • Field Details

    • pool

      protected final com.esotericsoftware.kryo.pool.KryoPool pool
  • Constructor Details

    • AbstractKryoStateMachineSerialisationService

      protected AbstractKryoStateMachineSerialisationService()
  • Method Details

    • serialiseStateMachineContext

      public byte[] serialiseStateMachineContext(StateMachineContext<S,E> context) throws Exception
      Description copied from interface: StateMachineSerialisationService
      Serialise state machine context into byte array.
      Specified by:
      serialiseStateMachineContext in interface StateMachineSerialisationService<S,E>
      Parameters:
      context - the context
      Returns:
      the data as byte[]
      Throws:
      Exception - the exception when serialisation fails
    • deserialiseStateMachineContext

      public StateMachineContext<S,E> deserialiseStateMachineContext(byte[] data) throws Exception
      Description copied from interface: StateMachineSerialisationService
      Deserialise state machine context from byte array.
      Specified by:
      deserialiseStateMachineContext in interface StateMachineSerialisationService<S,E>
      Parameters:
      data - the data
      Returns:
      the state machine context
      Throws:
      Exception - the exception when deserialisation fails
    • doEncode

      protected abstract void doEncode(com.esotericsoftware.kryo.Kryo kryo, Object object, com.esotericsoftware.kryo.io.Output output)
      Subclasses implement this method to encode with Kryo.
      Parameters:
      kryo - the Kryo instance
      object - the object to encode
      output - the Kryo Output instance
    • doDecode

      protected abstract <T> T doDecode(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, Class<T> type)
      Subclasses implement this method to decode with Kryo.
      Type Parameters:
      T - the type for decoded object
      Parameters:
      kryo - the Kryo instance
      input - the Kryo Input instance
      type - the class of the decoded object
      Returns:
      the decoded object
    • configureKryoInstance

      protected abstract void configureKryoInstance(com.esotericsoftware.kryo.Kryo kryo)
      Subclasses implement this to configure the kryo instance. This is invoked on each new Kryo instance when it is created.
      Parameters:
      kryo - the kryo instance