org.camunda.bpm.engine.impl.pvm.runtime
Class LegacyBehavior

java.lang.Object
  extended by org.camunda.bpm.engine.impl.pvm.runtime.LegacyBehavior

public class LegacyBehavior
extends Object

This class encapsulates legacy runtime behavior for the process engine.

Since 7.3 the behavior of certain bpmn elements has changed slightly.

1. Some elements which did not used to be scopes are now scopes:

2. In certain situations, executions which were both scope and concurrent were created. This used to be the case if a scope execution already had a single scope child execution and then concurrency was introduced (by a on interrupting boundary event or a non-interrupting event subprocess). In that case the existing scope execution was made concurrent. Starting from 7.3 this behavior is considered legacy. The new behavior is that the existing scope execution will not be made concurrent, instead, a new, concurrent execution will be created and be interleaved between the parent and the existing scope execution.

WARNING: Legacy behavior must not be turned off as a rolling upgrade. All process engines connected to the database need to be shut down and then the legacy behavior needs to be turned off.

Since:
7.3
Author:
Daniel Meyer

Field Summary
protected  boolean isConcurrentScopeExecutionEnabled
           
protected  boolean isEventSubprocessScope
           
protected  boolean isSequentialMiSubprocessScope
           
 
Constructor Summary
LegacyBehavior(boolean isOn)
           
 
Method Summary
 void cancelConcurrentScope(PvmExecutionImpl execution, PvmActivity cancellingActivity)
          Cancels an execution which is both concurrent and scope.
 Map<ScopeImpl,PvmExecutionImpl> createActivityExecutionMapping(List<PvmExecutionImpl> scopeExecutions, List<ScopeImpl> scopes)
          Creates an activity execution mapping, when the scope hierarchy and the execution hierarchy are out of sync.
 void createConcurrentScope(PvmExecutionImpl execution)
          Creates a concurrent scope.
 void destroyConcurrentScope(PvmExecutionImpl execution)
          Destroys a concurrent scope Execution.
protected  void ensureConcurrentScope(PvmExecutionImpl execution)
           
 boolean eventSubprocessComplete(ActivityExecution scopeExecution)
           
 boolean eventSubprocessConcurrentChildExecutionEnded(ActivityExecution scopeExecution, ActivityExecution endedExecution)
           
static LegacyBehavior get()
           
 PvmExecutionImpl getScopeExecution(ScopeImpl scope, Map<ScopeImpl,PvmExecutionImpl> activityExecutionMapping)
          In case the process instance was migrated from a previous version, activities which are now parsed as scopes do not have scope executions.
 boolean isConcurrentScopeExecutionEnabled()
           
 boolean isEventSubprocessScope()
           
protected  boolean isLegacyBehaviorRequired(ActivityExecution scopeExecution, boolean isLegacyBehaviorTurnedOff)
          This method
 boolean isSequentialMiSubprocessScope()
           
 ScopeImpl normalizeSecondNonScope(ScopeImpl scope)
          Usually you will find this line after a line which does the exact same thing as the implementation of this method.
 void pruneConcurrentScope(PvmExecutionImpl execution)
          Prunes a concurrent scope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isEventSubprocessScope

protected boolean isEventSubprocessScope

isSequentialMiSubprocessScope

protected boolean isSequentialMiSubprocessScope

isConcurrentScopeExecutionEnabled

protected boolean isConcurrentScopeExecutionEnabled
Constructor Detail

LegacyBehavior

public LegacyBehavior(boolean isOn)
Method Detail

get

public static LegacyBehavior get()

isEventSubprocessScope

public boolean isEventSubprocessScope()

isSequentialMiSubprocessScope

public boolean isSequentialMiSubprocessScope()

isConcurrentScopeExecutionEnabled

public boolean isConcurrentScopeExecutionEnabled()

createConcurrentScope

public void createConcurrentScope(PvmExecutionImpl execution)
Creates a concurrent scope. This can only happen if isConcurrentScopeExecutionEnabled() is (ie. the process engine is configured to perform legacy behavior). See: javadoc of this class for note about concurrent scopes.

Parameters:
execution -

pruneConcurrentScope

public void pruneConcurrentScope(PvmExecutionImpl execution)
Prunes a concurrent scope. This can only happen if (a) the process instance has been migrated from a previous version to a new version of the process engine (b) isConcurrentScopeExecutionEnabled() This is an inverse operation to createConcurrentScope(PvmExecutionImpl). See: javadoc of this class for note about concurrent scopes.

Parameters:
execution -

cancelConcurrentScope

public void cancelConcurrentScope(PvmExecutionImpl execution,
                                  PvmActivity cancellingActivity)
Cancels an execution which is both concurrent and scope. This can only happen if (a) the process instance has been migrated from a previous version to a new version of the process engine (b) isConcurrentScopeExecutionEnabled() See: javadoc of this class for note about concurrent scopes.

Parameters:
execution - the concurrent scope execution to destroy

destroyConcurrentScope

public void destroyConcurrentScope(PvmExecutionImpl execution)
Destroys a concurrent scope Execution. This can only happen if (a) the process instance has been migrated from a previous version to a 7.3+ version of the process engine (b) isConcurrentScopeExecutionEnabled() See: javadoc of this class for note about concurrent scopes.

Parameters:
execution - the execution to destroy

eventSubprocessComplete

public boolean eventSubprocessComplete(ActivityExecution scopeExecution)

eventSubprocessConcurrentChildExecutionEnded

public boolean eventSubprocessConcurrentChildExecutionEnded(ActivityExecution scopeExecution,
                                                            ActivityExecution endedExecution)

normalizeSecondNonScope

public ScopeImpl normalizeSecondNonScope(ScopeImpl scope)
Usually you will find this line after a line which does the exact same thing as the implementation of this method. Please don't try to be smart and replace both lines with a while loop or something!

The line you found above the line from which this method is called will always be necessary as long as we allow non-scope activities. What this method is doing is normalizing the fact that there may be even two non-scope activities executed by the same scope execution.

This can only happen if isEventSubprocessScope() is false or isSequentialMiSubprocessScope() is false;


isLegacyBehaviorRequired

protected boolean isLegacyBehaviorRequired(ActivityExecution scopeExecution,
                                           boolean isLegacyBehaviorTurnedOff)
This method

Parameters:
scopeExecution -
isLegacyBehaviorTurnedOff -
Returns:

getScopeExecution

public PvmExecutionImpl getScopeExecution(ScopeImpl scope,
                                          Map<ScopeImpl,PvmExecutionImpl> activityExecutionMapping)
In case the process instance was migrated from a previous version, activities which are now parsed as scopes do not have scope executions. Use the flow scopes of these activities in order to find their execution. - For an event subprocess this is the scope execution of the scope in which the event subprocess is embeded in - For a multi instance sequential subprocess this is the multi instace scope body.

Parameters:
targetScope -
activityExecutionMapping -
Returns:

ensureConcurrentScope

protected void ensureConcurrentScope(PvmExecutionImpl execution)

createActivityExecutionMapping

public Map<ScopeImpl,PvmExecutionImpl> createActivityExecutionMapping(List<PvmExecutionImpl> scopeExecutions,
                                                                      List<ScopeImpl> scopes)
Creates an activity execution mapping, when the scope hierarchy and the execution hierarchy are out of sync.

Parameters:
scopeExecutions -
scopes -
Returns:


Copyright © 2015 camunda services GmbH. All rights reserved.