SWF-1213 Added calls to lock/unlock the conversation when an execution is launched. This causes the conversation to be put back into the HTTP session.

This commit is contained in:
Rossen Stoyanchev
2010-04-07 20:17:51 +00:00
parent 5c5d1c322f
commit 76c9dbba80
2 changed files with 16 additions and 2 deletions

View File

@@ -139,7 +139,13 @@ public class FlowExecutorImpl implements FlowExecutor {
FlowExecution flowExecution = executionFactory.createFlowExecution(flowDefinition);
flowExecution.start(input, context);
if (!flowExecution.hasEnded()) {
executionRepository.putFlowExecution(flowExecution);
FlowExecutionLock lock = executionRepository.getLock(flowExecution.getKey());
lock.lock();
try {
executionRepository.putFlowExecution(flowExecution);
} finally {
lock.unlock();
}
return createPausedResult(flowExecution);
} else {
return createEndResult(flowExecution);

View File

@@ -53,11 +53,19 @@ public class FlowExecutorImplTests extends TestCase {
execution.hasEnded();
EasyMock.expectLastCall().andReturn(Boolean.FALSE);
MockFlowExecutionKey flowExecutionKey = new MockFlowExecutionKey("12345");
EasyMock.expect(execution.getKey()).andReturn(flowExecutionKey);
EasyMock.expect(repository.getLock(flowExecutionKey)).andReturn(lock);
lock.lock();
repository.putFlowExecution(execution);
lock.unlock();
EasyMock.expect(execution.getDefinition()).andReturn(definition);
EasyMock.expect(definition.getId()).andReturn("foo");
EasyMock.expect(execution.getKey()).andReturn(new MockFlowExecutionKey("12345"));
EasyMock.expect(execution.getKey()).andReturn(flowExecutionKey);
replayMocks();