### Eclipse Workspace Patch 1.0 #P jbpm4 Index: modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java =================================================================== --- modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java (revision 6397) +++ modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java (working copy) @@ -44,6 +44,8 @@ private static final long serialVersionUID = 1L; + private static List joiningExecutions = new ArrayList(); + private LockMode lockMode = LockMode.UPGRADE; private Expression multiplicity; @@ -71,7 +73,9 @@ execution.setState(Execution.STATE_INACTIVE_JOIN); execution.waitForSignal(); - + if (execution.isAsync()) { + joiningExecutions.add(execution.getDbid()); + } ExecutionImpl concurrentRoot = execution.getParent(); List joinedExecutions = getJoinedExecutions(concurrentRoot, activity); @@ -126,7 +130,7 @@ List joinedExecutions = new ArrayList(); Collection concurrentExecutions = concurrentRoot.getExecutions(); for (ExecutionImpl concurrentExecution: concurrentExecutions) { - if ( (Execution.STATE_INACTIVE_JOIN.equals(concurrentExecution.getState())) + if ( joiningExecutions.contains(concurrentExecution.getDbid()) || (Execution.STATE_INACTIVE_JOIN.equals(concurrentExecution.getState())) && (concurrentExecution.getActivity()==activity) ) { joinedExecutions.add(concurrentExecution); @@ -137,6 +141,7 @@ protected void endExecutions(List executions) { for (ExecutionImpl execution: executions) { + joiningExecutions.remove(execution.getDbid()); execution.end(); } } Index: modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListenerMessage.java =================================================================== --- modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListenerMessage.java (revision 6473) +++ modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListenerMessage.java (working copy) @@ -149,7 +149,7 @@ execution.setEventCompletedOperation(eventCompletedOperation); execution.setState((String) asyncExecutionInfo.get(KEY_STATE)); - + execution.setAsync(true); execution.performAtomicOperationSync(AtomicOperation.EXECUTE_EVENT_LISTENER); } Index: modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java =================================================================== --- modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java (revision 6453) +++ modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java (working copy) @@ -155,6 +155,8 @@ protected int eventListenerIndex; protected ObservableElementImpl eventSource; + + protected boolean async; // cached named executions ////////////////////////////////////////////////// @@ -1349,4 +1351,10 @@ public void setEventCompletedOperation(AtomicOperation eventCompletedOperation) { this.eventCompletedOperation = eventCompletedOperation; } + public boolean isAsync() { + return async; + } + public void setAsync(boolean async) { + this.async = async; + } } Index: modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivityMessage.java =================================================================== --- modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivityMessage.java (revision 6435) +++ modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivityMessage.java (working copy) @@ -41,7 +41,7 @@ protected void executeVoid(Environment environment) throws Exception { AsyncContinuations.restoreState(execution); - + execution.setAsync(true); execution.performAtomicOperationSync(AtomicOperation.EXECUTE_ACTIVITY); }