Class AbstractKryoStateMachineSerialisationService<S,E>
java.lang.Object
org.springframework.statemachine.kryo.AbstractKryoStateMachineSerialisationService<S,E>
- Type Parameters:
S
- the type of stateE
- 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.- Author:
- Janne Valkealahti
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
configureKryoInstance
(com.esotericsoftware.kryo.Kryo kryo) Subclasses implement this to configure the kryo instance.deserialiseStateMachineContext
(byte[] data) Deserialise state machine context from byte array.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.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.byte[]
serialiseStateMachineContext
(StateMachineContext<S, E> context) Serialise state machine context into byte array.
-
Field Details
-
pool
protected final com.esotericsoftware.kryo.pool.KryoPool pool
-
-
Constructor Details
-
AbstractKryoStateMachineSerialisationService
protected AbstractKryoStateMachineSerialisationService()
-
-
Method Details
-
serialiseStateMachineContext
Description copied from interface:StateMachineSerialisationService
Serialise state machine context into byte array.- Specified by:
serialiseStateMachineContext
in interfaceStateMachineSerialisationService<S,
E> - Parameters:
context
- the context- Returns:
- the data as byte[]
- Throws:
Exception
- the exception when serialisation fails
-
deserialiseStateMachineContext
Description copied from interface:StateMachineSerialisationService
Deserialise state machine context from byte array.- Specified by:
deserialiseStateMachineContext
in interfaceStateMachineSerialisationService<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 instanceobject
- the object to encodeoutput
- 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 instanceinput
- the Kryo Input instancetype
- 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
-