if (targetActivityId != null) {
List<Synchronizer> allSynchronizersAndEnds = new ArrayList<Synchronizer>();
allSynchronizersAndEnds.addAll(workflowProcess.getSynchronizers());
allSynchronizersAndEnds.addAll(workflowProcess.getEndNodes());
for (int i=0;i<allSynchronizersAndEnds.size();i++){
Synchronizer synchronizer = allSynchronizersAndEnds.get(i);
if (synchronizer.getName().equals("Synchronizer4")){
System.out.println(synchronizer.getName());
}
int volumn = 0;
if (synchronizer instanceof EndNode){
volumn = synchronizer.getEnteringTransitions().size();
}else{
volumn = synchronizer.getEnteringTransitions().size()*synchronizer.getLeavingTransitions().size();
}
IToken tokenTmp = new Token();
tokenTmp.setNodeId(synchronizer.getId());
tokenTmp.setAlive(false);
tokenTmp.setProcessInstanceId(thisTaskInst.getProcessInstanceId());
tokenTmp.setStepNumber(-1);
List<String> incomingTransitionIds = new ArrayList<String>();
boolean reachable = false;
List<Transition> enteringTrans = synchronizer.getEnteringTransitions();
for (int m=0;m<aliveActivityIdsAfterJump.size();m++){
String aliveActivityId = aliveActivityIdsAfterJump.get(m);
if (workflowProcess.isReachable(aliveActivityId, synchronizer.getId())){
Transition trans = null;
reachable = true;
for (int j=0;j<enteringTrans.size();j++){
trans = enteringTrans.get(j);
Node fromNode = (Node)trans.getFromNode();
if (workflowProcess.isReachable(aliveActivityId, fromNode.getId())){
if (!incomingTransitionIds.contains(trans.getId())){
incomingTransitionIds.add(trans.getId());
}
}
}
}
}
if (reachable){
tokenTmp.setValue(volumn-(incomingTransitionIds.size()*volumn/enteringTrans.size()));
IToken virtualToken = getJoinInfo(allTokens,synchronizer.getId());
if (virtualToken!=null){
persistenceService.deleteTokensForNode(thisTaskInst.getProcessInstanceId(), synchronizer.getId());
}
if (tokenTmp.getValue()!=0){
tokenTmp.setProcessInstance(processInstance);
persistenceService.saveOrUpdateToken(tokenTmp);