// We have to wrap our transaction to make sure that we are hydrated when the transaction runs.
return _server.enqueueTransaction(new ProcessCallable<T>(tx));
}
private Object getState(BpelInstanceWorker worker, ProcessInstanceDAO instanceDAO) {
ExecutionQueueImpl state = (ExecutionQueueImpl) worker.getCachedState(instanceDAO.getExecutionStateCounter());
if (state != null) return state;
if (isInMemory()) {
ProcessInstanceDaoImpl inmem = (ProcessInstanceDaoImpl) instanceDAO;
if (inmem.getSoup() != null) {
state = (ExecutionQueueImpl) inmem.getSoup();
}
} else {
byte[] daoState = instanceDAO.getExecutionState();
if (daoState != null) {
state = new ExecutionQueueImpl(getClass().getClassLoader());
state.setReplacementMap((ReplacementMap) _runtime.getReplacementMap(instanceDAO.getProcess().getProcessId()));
ByteArrayInputStream iis = new ByteArrayInputStream(daoState);
try {
state.read(iis);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}