S
- the type of stateE
- the type of eventpublic abstract class AbstractKryoStateMachineSerialisationService<S,E> extends java.lang.Object implements StateMachineSerialisationService<S,E>
StateMachineSerialisationService
using kryo.Modifier and Type | Field and Description |
---|---|
protected com.esotericsoftware.kryo.pool.KryoPool |
pool |
Modifier | Constructor and Description |
---|---|
protected |
AbstractKryoStateMachineSerialisationService() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
configureKryoInstance(com.esotericsoftware.kryo.Kryo kryo)
Subclasses implement this to configure the kryo instance.
|
StateMachineContext<S,E> |
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,
java.lang.Class<T> type)
Subclasses implement this method to decode with Kryo.
|
protected abstract void |
doEncode(com.esotericsoftware.kryo.Kryo kryo,
java.lang.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.
|
protected AbstractKryoStateMachineSerialisationService()
public byte[] serialiseStateMachineContext(StateMachineContext<S,E> context) throws java.lang.Exception
StateMachineSerialisationService
serialiseStateMachineContext
in interface StateMachineSerialisationService<S,E>
context
- the contextjava.lang.Exception
- the exception when serialisation failspublic StateMachineContext<S,E> deserialiseStateMachineContext(byte[] data) throws java.lang.Exception
StateMachineSerialisationService
deserialiseStateMachineContext
in interface StateMachineSerialisationService<S,E>
data
- the datajava.lang.Exception
- the exception when deserialisation failsprotected abstract void doEncode(com.esotericsoftware.kryo.Kryo kryo, java.lang.Object object, com.esotericsoftware.kryo.io.Output output)
kryo
- the Kryo instanceobject
- the object to encodeoutput
- the Kryo Output instanceprotected abstract <T> T doDecode(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, java.lang.Class<T> type)
T
- the type for decoded objectkryo
- the Kryo instanceinput
- the Kryo Input instancetype
- the class of the decoded objectprotected abstract void configureKryoInstance(com.esotericsoftware.kryo.Kryo kryo)
kryo
- the kryo instance