示例#1
0
        protected internal virtual ActivityExecution createConcurrentExecution(ActivityExecution scopeExecution)
        {
            ActivityExecution concurrentChild = scopeExecution.createExecution();

            scopeExecution.forceUpdate();
            concurrentChild.Concurrent = true;
            concurrentChild.Scope      = false;
            return(concurrentChild);
        }
示例#2
0
        public override void destroyInnerInstance(ActivityExecution concurrentExecution)
        {
            ActivityExecution scopeExecution = concurrentExecution.Parent;

            concurrentExecution.remove();
            scopeExecution.forceUpdate();

            int nrOfActiveInstances = getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES).Value;

            setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances - 1);
        }
示例#3
0
        public override void concurrentChildExecutionEnded(ActivityExecution scopeExecution, ActivityExecution endedExecution)
        {
            int nrOfCompletedInstances = getLoopVariable(scopeExecution, NUMBER_OF_COMPLETED_INSTANCES) + 1;

            setLoopVariable(scopeExecution, NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances);
            int nrOfActiveInstances = getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES) - 1;

            setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances);

            // inactivate the concurrent execution
            endedExecution.inactivate();
            endedExecution.ActivityInstanceId = null;

            // join
            scopeExecution.forceUpdate();
            // TODO: should the completion condition be evaluated on the scopeExecution or on the endedExecution?
            if (completionConditionSatisfied(endedExecution) || allExecutionsEnded(scopeExecution, endedExecution))
            {
                List <ActivityExecution> childExecutions = new List <ActivityExecution>(((PvmExecutionImpl)scopeExecution).NonEventScopeExecutions);
                foreach (ActivityExecution childExecution in childExecutions)
                {
                    // delete all not-ended instances; these are either active (for non-scope tasks) or inactive but have no activity id (for subprocesses, etc.)
                    if (childExecution.Active || childExecution.Activity == null)
                    {
                        ((PvmExecutionImpl)childExecution).deleteCascade("Multi instance completion condition satisfied.");
                    }
                    else
                    {
                        childExecution.remove();
                    }
                }

                scopeExecution.Activity = (PvmActivity)endedExecution.Activity.FlowScope;
                scopeExecution.Active   = true;
                leave(scopeExecution);
            }
            else
            {
                ((ExecutionEntity)scopeExecution).dispatchDelayedEventsAndPerformOperation((Callback <PvmExecutionImpl, Void>)null);
            }
        }
示例#4
0
        public static bool eventSubprocessConcurrentChildExecutionEnded(ActivityExecution scopeExecution, ActivityExecution endedExecution)
        {
            bool performLegacyBehavior = isLegacyBehaviorRequired(endedExecution);

            if (performLegacyBehavior)
            {
                LOG.endConcurrentExecutionInEventSubprocess();
                // notify the grandparent flow scope in a similar way PvmAtomicOperationAcitivtyEnd does
                ScopeImpl flowScope = endedExecution.Activity.FlowScope;
                if (flowScope != null)
                {
                    flowScope = flowScope.FlowScope;

                    if (flowScope != null)
                    {
                        if (flowScope == endedExecution.Activity.ProcessDefinition)
                        {
                            endedExecution.remove();
                            scopeExecution.tryPruneLastConcurrentChild();
                            scopeExecution.forceUpdate();
                        }
                        else
                        {
                            PvmActivity flowScopeActivity = (PvmActivity)flowScope;

                            ActivityBehavior activityBehavior = flowScopeActivity.ActivityBehavior;
                            if (activityBehavior is CompositeActivityBehavior)
                            {
                                ((CompositeActivityBehavior)activityBehavior).concurrentChildExecutionEnded(scopeExecution, endedExecution);
                            }
                        }
                    }
                }
            }

            return(performLegacyBehavior);
        }