示例#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
        /// <summary>
        /// we create a separate execution for each compensation handler invocation.
        /// </summary>
        public static void throwCompensationEvent(IList <EventSubscriptionEntity> eventSubscriptions, ActivityExecution execution, bool async)
        {
            // first spawn the compensating executions
            foreach (EventSubscriptionEntity eventSubscription in eventSubscriptions)
            {
                // check whether compensating execution is already created
                // (which is the case when compensating an embedded subprocess,
                // where the compensating execution is created when leaving the subprocess
                // and holds snapshot data).
                ExecutionEntity compensatingExecution = getCompensatingExecution(eventSubscription);
                if (compensatingExecution != null)
                {
                    if (compensatingExecution.Parent != execution)
                    {
                        // move the compensating execution under this execution if this is not the case yet
                        compensatingExecution.Parent = (PvmExecutionImpl)execution;
                    }

                    compensatingExecution.EventScope = false;
                }
                else
                {
                    compensatingExecution           = (ExecutionEntity)execution.createExecution();
                    eventSubscription.Configuration = compensatingExecution.Id;
                }
                compensatingExecution.Concurrent = true;
            }

            // signal compensation events in REVERSE order of their 'created' timestamp
            eventSubscriptions.Sort(new ComparatorAnonymousInnerClass());

            foreach (EventSubscriptionEntity compensateEventSubscriptionEntity in eventSubscriptions)
            {
                compensateEventSubscriptionEntity.eventReceived(null, async);
            }
        }