protected void dispatchScopeEvents(PvmExecutionImpl execution) {
    PvmExecutionImpl scopeExecution = execution.isScope() ? execution : execution.getParent();

    List<DelayedVariableEvent> delayedEvents = new ArrayList<>(scopeExecution.getDelayedEvents());
    scopeExecution.clearDelayedEvents();

    Map<PvmExecutionImpl, String> activityInstanceIds = new HashMap<>();
    Map<PvmExecutionImpl, String> activityIds = new HashMap<>();
    initActivityIds(delayedEvents, activityInstanceIds, activityIds);

    //For each delayed variable event we have to check if the delayed event can be dispatched,
    //the check will be done with the help of the activity id and activity instance id.
    //That means it will be checked if the dispatching changed the execution tree in a way that we can't dispatch the
    //the other delayed variable events. We have to check the target scope with the last activity id and activity instance id
    //and also the replace pointer if it exist. Because on concurrency the replace pointer will be set on which we have
    //to check the latest state.
    for (DelayedVariableEvent event : delayedEvents) {
      PvmExecutionImpl targetScope = event.getTargetScope();
      PvmExecutionImpl replaced = targetScope.getReplacedBy() != null ? targetScope.getReplacedBy() : targetScope;
      dispatchOnSameActivity(targetScope, replaced, activityIds, activityInstanceIds, event);
    }
  }
protected void dispatchScopeEvents ( PvmExecutionImpl execution ) { PvmExecutionImpl scopeExecution = execution . isScope ( ) ? execution : execution . getParent ( ) ; List < DelayedVariableEvent > delayedEvents = new ArrayList < > ( scopeExecution . getDelayedEvents ( ) ) ; scopeExecution . clearDelayedEvents ( ) ; Map < PvmExecutionImpl , String > activityInstanceIds = new HashMap < > ( ) ; Map < PvmExecutionImpl , String > activityIds = new HashMap < > ( ) ; initActivityIds ( delayedEvents , activityInstanceIds , activityIds ) ; for ( DelayedVariableEvent event : delayedEvents ) { PvmExecutionImpl targetScope = event . getTargetScope ( ) ; PvmExecutionImpl replaced = targetScope . getReplacedBy ( ) != null ? targetScope . getReplacedBy ( ) : targetScope ; dispatchOnSameActivity ( targetScope , replaced , activityIds , activityInstanceIds , event ) ; } }
Dispatches the current delayed variable events on the scope of the given execution.

@param execution the execution on which scope the delayed variable should be dispatched