MarshallerWriteContext context = new MarshallerWriteContext(baos,
null, null, null, null);
String processType = ((ProcessInstanceImpl) processInstance)
.getProcess().getType();
saveProcessInstanceType(context, processInstance, processType);
ProcessInstanceMarshaller marshaller = ProcessMarshallerRegistry.INSTANCE
.getMarshaller(processType);
externalVariables = VariablePersistenceStrategyFactory.getVariablePersistenceStrategy().isEnabled();
marshaller.writeProcessInstance(context, processInstance, !externalVariables);
if (externalVariables) {
variablesChanged = persistVariables();
}
context.close();
} catch (IOException e) {