Exemple #1
0
        public override ActivityExecution createInnerInstance(ActivityExecution scopeExecution)
        {
            if (hasLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES) && getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES) > 0)
            {
                throw LOG.unsupportedConcurrencyException(scopeExecution.ToString(), this.GetType().Name);
            }
            else
            {
                int nrOfInstances = getLoopVariable(scopeExecution, NUMBER_OF_INSTANCES).Value;

                setLoopVariable(scopeExecution, LOOP_COUNTER, nrOfInstances);
                setLoopVariable(scopeExecution, NUMBER_OF_INSTANCES, nrOfInstances + 1);
                setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, 1);
            }

            return(scopeExecution);
        }
Exemple #2
0
        public override IList <ActivityExecution> initializeScope(ActivityExecution scopeExecution, int nrOfInstances)
        {
            if (nrOfInstances > 1)
            {
                LOG.unsupportedConcurrencyException(scopeExecution.ToString(), this.GetType().Name);
            }

            IList <ActivityExecution> executions = new List <ActivityExecution>();

            prepareScope(scopeExecution, nrOfInstances);
            setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfInstances);

            if (nrOfInstances > 0)
            {
                setLoopVariable(scopeExecution, LOOP_COUNTER, 0);
                executions.Add(scopeExecution);
            }

            return(executions);
        }