Package org.jbpm.marshalling.impl
Class ProcessInstanceResolverStrategy
- java.lang.Object
-
- org.jbpm.marshalling.impl.ProcessInstanceResolverStrategy
-
- All Implemented Interfaces:
org.kie.api.marshalling.ObjectMarshallingStrategy
public class ProcessInstanceResolverStrategy extends Object implements org.kie.api.marshalling.ObjectMarshallingStrategy
When using this strategy, knowledge session de/marshalling process will make sure that the processInstance is not serialized as a part of the the session/network. Instead, this strategy, which may only be used forProcessInstance
objects, saves the process instance in theProcessInstanceManager
, and later retrieves it from there. Should a process instance be completed or aborted, it will be restored as an empty RuleFlowProcessInstance with correct id and state completed, yet no internal details. If you're doing tricky things with serialization and persistence, please make sure to remember that theProcessInstanceManager
cache of process instances is emptied at the end of every transaction (commit).
-
-
Constructor Summary
Constructors Constructor Description ProcessInstanceResolverStrategy()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Object object)
org.kie.api.marshalling.ObjectMarshallingStrategy.Context
createContext()
byte[]
marshal(org.kie.api.marshalling.ObjectMarshallingStrategy.Context context, ObjectOutputStream os, Object object)
Object
read(ObjectInputStream is)
static org.drools.core.common.InternalKnowledgeRuntime
retrieveKnowledgeRuntime(Object streamContext)
Retrieve theProcessInstanceManager
object from the ObjectOutput- or ObjectInputStream.static ProcessInstanceManager
retrieveProcessInstanceManager(Object streamContext)
Retrieve theProcessInstanceManager
object from the ObjectOutput- or ObjectInputStream.Object
unmarshal(org.kie.api.marshalling.ObjectMarshallingStrategy.Context context, ObjectInputStream is, byte[] object, ClassLoader classloader)
void
write(ObjectOutputStream os, Object object)
-
-
-
Method Detail
-
accept
public boolean accept(Object object)
- Specified by:
accept
in interfaceorg.kie.api.marshalling.ObjectMarshallingStrategy
-
write
public void write(ObjectOutputStream os, Object object) throws IOException
- Specified by:
write
in interfaceorg.kie.api.marshalling.ObjectMarshallingStrategy
- Throws:
IOException
-
read
public Object read(ObjectInputStream is) throws IOException, ClassNotFoundException
- Specified by:
read
in interfaceorg.kie.api.marshalling.ObjectMarshallingStrategy
- Throws:
IOException
ClassNotFoundException
-
retrieveProcessInstanceManager
public static ProcessInstanceManager retrieveProcessInstanceManager(Object streamContext)
Retrieve theProcessInstanceManager
object from the ObjectOutput- or ObjectInputStream. The stream object will secretly also either be aMarshallerReaderContext
or aMarshallerWriteContext
.- Parameters:
streamContext
- The marshaller stream/context.- Returns:
- A
ProcessInstanceManager
object.
-
retrieveKnowledgeRuntime
public static org.drools.core.common.InternalKnowledgeRuntime retrieveKnowledgeRuntime(Object streamContext)
Retrieve theProcessInstanceManager
object from the ObjectOutput- or ObjectInputStream. The stream object will secretly also either be aMarshallerReaderContext
or aMarshallerWriteContext
. The knowledge runtime object is useful in order to reconnect the process instance to the process and the knowledge runtime object.- Parameters:
streamContext
- The marshaller stream/context.- Returns:
- A
InternalKnowledgeRuntime
object.
-
marshal
public byte[] marshal(org.kie.api.marshalling.ObjectMarshallingStrategy.Context context, ObjectOutputStream os, Object object) throws IOException
- Specified by:
marshal
in interfaceorg.kie.api.marshalling.ObjectMarshallingStrategy
- Throws:
IOException
-
unmarshal
public Object unmarshal(org.kie.api.marshalling.ObjectMarshallingStrategy.Context context, ObjectInputStream is, byte[] object, ClassLoader classloader) throws IOException, ClassNotFoundException
- Specified by:
unmarshal
in interfaceorg.kie.api.marshalling.ObjectMarshallingStrategy
- Throws:
IOException
ClassNotFoundException
-
createContext
public org.kie.api.marshalling.ObjectMarshallingStrategy.Context createContext()
- Specified by:
createContext
in interfaceorg.kie.api.marshalling.ObjectMarshallingStrategy
-
-