public ProcessInstance getProcessInstance(WorkingMemory workingMemory) {
if (processInstance == null) {
try {
ByteArrayInputStream bais = new ByteArrayInputStream(
processInstanceByteArray);
MarshallerReaderContext context = new MarshallerReaderContext(
bais, (InternalRuleBase) workingMemory.getRuleBase(), null, null);
context.wm = (InternalWorkingMemory) workingMemory;
ProcessInstanceMarshaller marshaller = getMarshallerFromContext(context);
processInstance = marshaller.readProcessInstance(context);
context.close();
} catch (IOException e) {
e.printStackTrace();
throw new IllegalArgumentException(
"IOException while loading process instance: "
+ e.getMessage());