private static void FireEvents(List<SchedulerLockGuardInfo> eventList, WorkflowExecutor workflowExec)
 {
     if (!workflowExec.IsInstanceValid && ((workflowExec.WorkflowStatus == WorkflowStatus.Completed) || (workflowExec.WorkflowStatus == WorkflowStatus.Terminated)))
     {
         workflowExec.WorkflowInstance.DeadWorkflow = workflowExec;
     }
     for (int i = 0; i < eventList.Count; i++)
     {
         SchedulerLockGuardInfo info = eventList[i];
         WorkflowEventInternal eventType = info.EventType;
         if (eventType != WorkflowEventInternal.Suspended)
         {
             if (eventType == WorkflowEventInternal.Terminated)
             {
                 goto Label_0057;
             }
             goto Label_008A;
         }
         workflowExec.FireWorkflowSuspended((string) info.EventInfo);
         continue;
     Label_0057:
         if (info.EventInfo is Exception)
         {
             workflowExec.FireWorkflowTerminated((Exception) info.EventInfo);
         }
         else
         {
             workflowExec.FireWorkflowTerminated((string) info.EventInfo);
         }
         continue;
     Label_008A:
         workflowExec.FireWorkflowExecutionEvent(info.Sender, info.EventType);
     }
 }
 internal static void Exit(InstanceLock il, WorkflowExecutor w)
 {
     List<SchedulerLockGuardInfo> eventList = new List<SchedulerLockGuardInfo>(w.EventsToFireList);
     w.EventsToFireList.Clear();
     il.Exit();
     FireEvents(eventList, w);
 }
 internal CreationContext(Type type, WorkflowExecutor invokerExec, string invokeActivityID, Dictionary<string, object> args)
 {
     Type = type;
     InvokerExecutor = invokerExec;
     InvokeActivityID = invokeActivityID;
     Args = args;
     IsActivation = true;
 }
 internal RTTrackingProfile GetTrackingProfile(WorkflowExecutor skedExec)
 {
     if (this._profile == null)
     {
         throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ExecutionStringManager.NullProfileForChannel, new object[] { this._scheduleType.AssemblyQualifiedName }));
     }
     return this._profile;
 }
 internal CreationContext(System.Type type, WorkflowExecutor invokerExec, string invokeActivityID, Dictionary<string, object> args)
 {
     this.Type = type;
     this.InvokerExecutor = invokerExec;
     this.InvokeActivityID = invokeActivityID;
     this.Args = args;
     this.IsActivation = true;
 }
 internal CreationContext(XmlReader xomlReader, XmlReader rulesReader, Dictionary<string, object> args)
 {
     XomlReader = xomlReader;
     RulesReader = rulesReader;
     InvokerExecutor = null;
     InvokeActivityID = null;
     Args = args;
     IsActivation = true;
 }
 private void Notify(PerformanceCounterAction action, WorkflowExecutor executor)
 {
     List<PerformanceCounterStatement> list;
     if (this.m_actionStatements.TryGetValue(action, out list))
     {
         foreach (PerformanceCounterStatement statement in list)
         {
             this.NotifyCounter(action, statement, executor);
         }
     }
 }
 internal TrackingListener(TrackingListenerFactory factory, Activity sked, WorkflowExecutor exec, List<TrackingChannelWrapper> channels, TrackingListenerBroker broker, bool load)
 {
     if ((sked == null) || (broker == null))
     {
         WorkflowTrace.Tracking.TraceEvent(TraceEventType.Error, 0, ExecutionStringManager.NullParameters);
     }
     else
     {
         this._factory = factory;
         this._channels = channels;
         this._broker = broker;
         this._broker.TrackingListener = this;
     }
 }
 internal void MakeProfilePrivate(WorkflowExecutor exec)
 {
     if (this._profile != null)
     {
         if (!this._profile.IsPrivate)
         {
             this._profile = this._profile.Clone();
             this._profile.IsPrivate = true;
         }
     }
     else
     {
         this._profile = this.GetTrackingProfile(exec).Clone();
         this._profile.IsPrivate = true;
     }
 }
 internal void RevertToCheckpointState()
 {
     Activity rootActivity = null;
     this.clonedInstanceStateStream.Position = 0L;
     using (new RuntimeEnvironment(this.workflowExecutor.WorkflowRuntime))
     {
         rootActivity = Activity.Load(this.clonedInstanceStateStream, this.workflowDefinition);
     }
     rootActivity.SetValue(WorkflowExecutor.TrackingListenerBrokerProperty, this.workflowExecutor.RootActivity.GetValue(WorkflowExecutor.TrackingListenerBrokerProperty));
     WorkflowExecutor newWorkflowExecutor = new WorkflowExecutor(Guid.Empty);
     newWorkflowExecutor.Initialize(rootActivity, this.workflowExecutor.WorkflowRuntime, this.workflowExecutor);
     Activity contextActivityForId = newWorkflowExecutor.GetContextActivityForId(this.activityContextId);
     Activity activityByName = contextActivityForId.GetActivityByName(this.activityQualifiedName);
     using (new ServiceEnvironment(activityByName))
     {
         using (newWorkflowExecutor.SetCurrentActivity(activityByName))
         {
             using (ActivityExecutionContext context = new ActivityExecutionContext(activityByName))
             {
                 context.Invoke<EventArgs>(this.callbackHandler, this.callbackData);
             }
         }
     }
     newWorkflowExecutor.BatchCollection.WorkItemOrderId = this.workflowExecutor.BatchCollection.WorkItemOrderId;
     foreach (KeyValuePair<object, WorkBatch> pair in this.workflowExecutor.BatchCollection)
     {
         pair.Value.SetWorkBatchCollection(newWorkflowExecutor.BatchCollection);
         Activity key = pair.Key as Activity;
         if (key != null)
         {
             Activity activity5 = contextActivityForId.GetActivityByName(key.QualifiedName);
             newWorkflowExecutor.BatchCollection.Add(activity5, pair.Value);
         }
     }
     this.workflowExecutor.BatchCollection.Clear();
     newWorkflowExecutor.CompletedContextActivities = this.completedContextActivities;
     this.workflowExecutor.WorkflowRuntime.ReplaceWorkflowExecutor(this.workflowExecutor.InstanceId, this.workflowExecutor, newWorkflowExecutor);
     if (!this.suspendOnRevert)
     {
         newWorkflowExecutor.Scheduler.Resume();
     }
     else
     {
         newWorkflowExecutor.SuspendOnIdle(this.suspendOnRevertInfo);
     }
     this.DisposeCheckpointState();
 }
 public Scheduler(WorkflowExecutor rootExec, bool canRun)
 {
     this.rootWorkflowExecutor = rootExec;
     this.threadRequested = false;
     this.canRun = canRun;
     this.highPriorityEntriesQueue = (Queue<SchedulableItem>) rootExec.RootActivity.GetValue(HighPriorityEntriesQueueProperty);
     this.normalPriorityEntriesQueue = (Queue<SchedulableItem>) rootExec.RootActivity.GetValue(NormalPriorityEntriesQueueProperty);
     if (this.highPriorityEntriesQueue == null)
     {
         this.highPriorityEntriesQueue = new Queue<SchedulableItem>();
         rootExec.RootActivity.SetValue(HighPriorityEntriesQueueProperty, this.highPriorityEntriesQueue);
     }
     if (this.normalPriorityEntriesQueue == null)
     {
         this.normalPriorityEntriesQueue = new Queue<SchedulableItem>();
         rootExec.RootActivity.SetValue(NormalPriorityEntriesQueueProperty, this.normalPriorityEntriesQueue);
     }
     this.empty = (this.normalPriorityEntriesQueue.Count == 0) && (this.highPriorityEntriesQueue.Count == 0);
 }
 internal void DynamicUpdateBegin(object sender, WorkflowExecutor.DynamicUpdateEventArgs e)
 {
     if (sender == null)
     {
         throw new ArgumentNullException("sender");
     }
     if (!typeof(WorkflowExecutor).IsInstanceOfType(sender))
     {
         throw new ArgumentException("sender");
     }
     WorkflowExecutor exec = (WorkflowExecutor) sender;
     if (e.ChangeActions != null)
     {
         this.MakeProfilesPrivate(exec);
         foreach (TrackingChannelWrapper wrapper in this._channels)
         {
             wrapper.GetTrackingProfile(exec).WorkflowChangeBegin(e.ChangeActions);
         }
     }
 }
 internal void ActivityStatusChange(object sender, WorkflowExecutor.ActivityStatusChangeEventArgs e)
 {
     WorkflowTrace.Tracking.TraceInformation("TrackingListener::ActivityStatusChange - Received Activity Status Change Event for activity {0}", new object[] { e.Activity.QualifiedName });
     if (sender == null)
     {
         throw new ArgumentNullException("sender");
     }
     if (!typeof(WorkflowExecutor).IsInstanceOfType(sender))
     {
         throw new ArgumentException("sender");
     }
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     WorkflowExecutor exec = (WorkflowExecutor) sender;
     if ((this._channels == null) || (this._channels.Count <= 0))
     {
         WorkflowTrace.Tracking.TraceEvent(TraceEventType.Error, 0, ExecutionStringManager.NoChannels);
     }
     else
     {
         Activity activity = e.Activity;
         if (this.SubscriptionRequired(activity, exec))
         {
             Guid empty = Guid.Empty;
             Guid contextGuid = Guid.Empty;
             this.GetContext(activity, exec, out contextGuid, out empty);
             DateTime utcNow = DateTime.UtcNow;
             int nextEventOrderId = this._broker.GetNextEventOrderId();
             foreach (TrackingChannelWrapper wrapper in this._channels)
             {
                 ActivityTrackingRecord record = new ActivityTrackingRecord(activity.GetType(), activity.QualifiedName, contextGuid, empty, activity.ExecutionStatus, utcNow, nextEventOrderId, null);
                 if (wrapper.GetTrackingProfile(exec).TryTrackActivityEvent(activity, activity.ExecutionStatus, exec, record))
                 {
                     wrapper.TrackingChannel.Send(record);
                 }
             }
         }
     }
 }
Esempio n. 14
0
        // loading with some state
        public Scheduler(WorkflowExecutor rootExec, bool canRun)
        {
            this.rootWorkflowExecutor = rootExec;
            this.threadRequested = false;

            // canRun is true if normal creation
            // false if loading from a persisted state. Will be set to true later at ResumeOnIdle
            this.canRun = canRun;

            this.highPriorityEntriesQueue = (Queue<SchedulableItem>)rootExec.RootActivity.GetValue(Scheduler.HighPriorityEntriesQueueProperty);
            this.normalPriorityEntriesQueue = (Queue<SchedulableItem>)rootExec.RootActivity.GetValue(Scheduler.NormalPriorityEntriesQueueProperty);
            if (this.highPriorityEntriesQueue == null)
            {
                this.highPriorityEntriesQueue = new Queue<SchedulableItem>();
                rootExec.RootActivity.SetValue(Scheduler.HighPriorityEntriesQueueProperty, this.highPriorityEntriesQueue);
            }
            if (this.normalPriorityEntriesQueue == null)
            {
                this.normalPriorityEntriesQueue = new Queue<SchedulableItem>();
                rootExec.RootActivity.SetValue(Scheduler.NormalPriorityEntriesQueueProperty, this.normalPriorityEntriesQueue);
            }

            this.empty = ((this.normalPriorityEntriesQueue.Count == 0) && (this.highPriorityEntriesQueue.Count == 0));
        }
Esempio n. 15
0
 private void OnInstanceEvent(object sender, WorkflowExecutor.WorkflowExecutionEventArgs e)
 {
     switch (e.EventType)
     {
         case WorkflowEventInternal.Completed:
             InstanceCompleted(sender, new WorkflowEventArgs(((WorkflowExecutor)sender).WorkflowInstance));
             break;
         case WorkflowEventInternal.Terminated:
             InstanceTerminated(sender, new WorkflowEventArgs(((WorkflowExecutor)sender).WorkflowInstance));
             break;
         case WorkflowEventInternal.Unloaded:
             InstanceUnloaded(sender, new WorkflowEventArgs(((WorkflowExecutor)sender).WorkflowInstance));
             break;
         case WorkflowEventInternal.Changed:
             OnWorkflowChanged(sender, e);
             break;
         case WorkflowEventInternal.HandlerInvoking:
             OnHandlerInvoking(sender, e);
             break;
         case WorkflowEventInternal.HandlerInvoked:
             OnHandlerInvoked(sender, e);
             break;
         case WorkflowEventInternal.ActivityStatusChange:
             OnActivityStatusChanged(sender, (WorkflowExecutor.ActivityStatusChangeEventArgs)e);
             break;
         case WorkflowEventInternal.ActivityExecuting:
             OnActivityExecuting(sender, (WorkflowExecutor.ActivityExecutingEventArgs)e);
             break;
         default:
             return;
     }
 }
        private void WorkflowExecutionEvent(object sender, WorkflowExecutor.WorkflowExecutionEventArgs e)
        {
            if (null == sender)
                throw new ArgumentNullException("sender");

            if (!typeof(WorkflowExecutor).IsInstanceOfType(sender))
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, ExecutionStringManager.InvalidArgumentType, "sender", typeof(WorkflowExecutor).ToString()));

            WorkflowExecutor exec = (WorkflowExecutor)sender;

            PerformanceCounterAction action;

            switch (e.EventType)
            {
                case WorkflowEventInternal.Created:
                    action = PerformanceCounterAction.Creation;
                    break;
                case WorkflowEventInternal.Started:
                    action = PerformanceCounterAction.Starting;
                    break;
                case WorkflowEventInternal.Runnable:
                    action = PerformanceCounterAction.Runnable;
                    break;
                case WorkflowEventInternal.Executing:
                    action = PerformanceCounterAction.Executing;
                    break;
                case WorkflowEventInternal.NotExecuting:
                    action = PerformanceCounterAction.NotExecuting;
                    break;
                case WorkflowEventInternal.Resumed:
                    action = PerformanceCounterAction.Resumption;
                    break;
                case WorkflowEventInternal.SchedulerEmpty:
                    //
                    // SchedulerEmpty signals that are about to persist
                    // after which we will be idle.  We need to do the idle
                    // work now so that it is included in the state for the idle persist.
                    action = PerformanceCounterAction.Idle;
                    break;
                case WorkflowEventInternal.Completed:
                    action = PerformanceCounterAction.Completion;
                    break;
                case WorkflowEventInternal.Suspended:
                    action = PerformanceCounterAction.Suspension;
                    break;
                case WorkflowEventInternal.Terminated:
                    action = PerformanceCounterAction.Termination;
                    break;
                case WorkflowEventInternal.Loaded:
                    action = PerformanceCounterAction.Loading;
                    break;
                case WorkflowEventInternal.Aborted:
                    action = PerformanceCounterAction.Aborted;
                    break;
                case WorkflowEventInternal.Unloaded:
                    action = PerformanceCounterAction.Unloading;
                    break;
                case WorkflowEventInternal.Persisted:
                    action = PerformanceCounterAction.Persisted;
                    break;
                default:
                    return;
            }
            Notify(action, exec);
        }
        private void NotifyCounter(PerformanceCounterAction action, PerformanceCounterStatement statement, WorkflowExecutor executor)
        {
            foreach (PerformanceCounter counter in statement.Counters)
            {
                switch (statement.Operation)
                {
                    case PerformanceCounterOperation.Increment:
                        counter.Increment();
                        break;

                    case PerformanceCounterOperation.Decrement:
                        counter.Decrement();
                        break;

                    default:
                        System.Diagnostics.Debug.Assert(false, "Unknown performance counter operation.");
                        break;
                }
            }
        }
        private void Notify(PerformanceCounterAction action, WorkflowExecutor executor)
        {
            System.Diagnostics.Debug.Assert(this.m_actionStatements != null);

            List<PerformanceCounterStatement> lStatements;

            if (this.m_actionStatements.TryGetValue(action, out lStatements))
            {
                foreach (PerformanceCounterStatement statement in lStatements)
                {
                    NotifyCounter(action, statement, executor);
                }
            }
        }
 internal bool TryTrackUserEvent(Activity activity, string keyName, object argument, WorkflowExecutor exec, UserTrackingRecord record)
 {
     List<UserTrackPoint> points;
     if (TryGetCacheItems(activity, out points))
     {
         bool ret = false;
         foreach (UserTrackPoint point in points)
         {
             if (point.IsMatch(activity, keyName, argument))
             {
                 ret = true;
                 point.Track(activity, argument, exec, record.Body);
                 record.Annotations.AddRange(point.Annotations);
             }
         }
         return ret;
     }
     return false;
 }
 private List<TrackingChannelWrapper> GetChannels(Activity schedule, WorkflowExecutor exec, Guid instanceID, Type workflowType, ref TrackingListenerBroker broker)
 {
     if (this._services == null)
     {
         return null;
     }
     bool flag = false;
     if (broker == null)
     {
         broker = new TrackingListenerBroker();
         flag = true;
     }
     List<TrackingChannelWrapper> list = new List<TrackingChannelWrapper>();
     List<string> callPath = null;
     Guid empty = Guid.Empty;
     Guid context = this.GetContext(exec.RootActivity);
     Guid callerContextGuid = Guid.Empty;
     Guid callerParentContextGuid = Guid.Empty;
     TrackingCallingState trackingCallingState = exec.TrackingCallingState;
     TrackingListenerBroker broker1 = (TrackingListenerBroker) exec.RootActivity.GetValue(WorkflowExecutor.TrackingListenerBrokerProperty);
     IList<string> collection = (trackingCallingState != null) ? trackingCallingState.CallerActivityPathProxy : null;
     if ((collection != null) && (collection.Count > 0))
     {
         callPath = new List<string>(collection);
         empty = trackingCallingState.CallerWorkflowInstanceId;
         callerContextGuid = trackingCallingState.CallerContextGuid;
         callerParentContextGuid = trackingCallingState.CallerParentContextGuid;
     }
     TrackingParameters parameters = new TrackingParameters(instanceID, workflowType, exec.WorkflowDefinition, callPath, empty, context, callerContextGuid, callerParentContextGuid);
     for (int i = 0; i < this._services.Count; i++)
     {
         TrackingChannel trackingChannel = null;
         Type trackingServiceType = this._services[i].GetType();
         RTTrackingProfile profile = null;
         if (flag)
         {
             profile = this._profileManager.GetProfile(this._services[i], schedule);
             if (profile == null)
             {
                 continue;
             }
             broker.AddService(trackingServiceType, profile.Version);
         }
         else
         {
             if (!broker.ContainsService(trackingServiceType))
             {
                 continue;
             }
             if (broker.IsProfileInstance(trackingServiceType))
             {
                 profile = this._profileManager.GetProfile(this._services[i], schedule, instanceID);
                 if (profile == null)
                 {
                     throw new InvalidOperationException(ExecutionStringManager.MissingProfileForService + trackingServiceType.ToString());
                 }
                 profile.IsPrivate = true;
             }
             else
             {
                 Version version;
                 if (!broker.TryGetProfileVersionId(trackingServiceType, out version))
                 {
                     continue;
                 }
                 profile = this._profileManager.GetProfile(this._services[i], schedule, version);
                 if (profile == null)
                 {
                     throw new InvalidOperationException(ExecutionStringManager.MissingProfileForService + trackingServiceType.ToString() + ExecutionStringManager.MissingProfileForVersion + version.ToString());
                 }
                 if (broker.IsProfilePrivate(trackingServiceType))
                 {
                     profile = profile.Clone();
                     profile.IsPrivate = true;
                 }
             }
         }
         trackingChannel = this._services[i].GetTrackingChannel(parameters);
         if (trackingChannel == null)
         {
             throw new InvalidOperationException(ExecutionStringManager.NullChannel);
         }
         list.Add(new TrackingChannelWrapper(trackingChannel, this._services[i].GetType(), workflowType, profile));
     }
     return list;
 }
 internal void ReloadProfiles(WorkflowExecutor exec, Guid instanceId, ref TrackingListenerBroker broker, ref List<TrackingChannelWrapper> channels)
 {
     Type workflowType = exec.WorkflowDefinition.GetType();
     foreach (TrackingService service in this._services)
     {
         TrackingProfile profile = null;
         TrackingChannelWrapper wrapper = null;
         if (service.TryReloadProfile(workflowType, instanceId, out profile))
         {
             bool flag = false;
             int index = 0;
             while (index < channels.Count)
             {
                 if (service.GetType() == channels[index].TrackingServiceType)
                 {
                     wrapper = channels[index];
                     flag = true;
                     break;
                 }
                 index++;
             }
             if (profile == null)
             {
                 if (flag)
                 {
                     broker.RemoveService(wrapper.TrackingServiceType);
                     channels.RemoveAt(index);
                 }
             }
             else
             {
                 RTTrackingProfile profile2 = new RTTrackingProfile(profile, exec.WorkflowDefinition, workflowType) {
                     IsPrivate = true
                 };
                 if (!flag)
                 {
                     List<string> callPath = null;
                     Guid empty = Guid.Empty;
                     TrackingCallingState trackingCallingState = exec.TrackingCallingState;
                     IList<string> collection = null;
                     Guid context = this.GetContext(exec.RootActivity);
                     Guid callerContextGuid = Guid.Empty;
                     Guid callerParentContextGuid = Guid.Empty;
                     if (trackingCallingState != null)
                     {
                         collection = trackingCallingState.CallerActivityPathProxy;
                         if ((collection != null) && (collection.Count > 0))
                         {
                             callPath = new List<string>(collection);
                             empty = trackingCallingState.CallerWorkflowInstanceId;
                             callerContextGuid = trackingCallingState.CallerContextGuid;
                             callerParentContextGuid = trackingCallingState.CallerParentContextGuid;
                         }
                     }
                     TrackingParameters parameters = new TrackingParameters(instanceId, workflowType, exec.WorkflowDefinition, callPath, empty, context, callerContextGuid, callerParentContextGuid);
                     TrackingChannelWrapper item = new TrackingChannelWrapper(service.GetTrackingChannel(parameters), service.GetType(), workflowType, profile2);
                     channels.Add(item);
                     Type type = service.GetType();
                     broker.AddService(type, profile2.Version);
                     broker.MakeProfileInstance(type);
                 }
                 else
                 {
                     wrapper.SetTrackingProfile(profile2);
                     broker.MakeProfileInstance(wrapper.TrackingServiceType);
                 }
             }
         }
     }
 }
 public ScheduleWork(WorkflowExecutor executor, bool suppress)
 {
     this.oldValue = scheduleInfo;
     scheduleInfo = new ScheduleInfo(executor, suppress);
 }
Esempio n. 23
0
 private static void FireEvents(List<SchedulerLockGuardInfo> eventList, WorkflowExecutor workflowExec)
 {
     if (!workflowExec.IsInstanceValid && (workflowExec.WorkflowStatus == WorkflowStatus.Completed || workflowExec.WorkflowStatus == WorkflowStatus.Terminated))
     {
         // The workflow is dead, let the instance have a hard ref to the corpse for support of the query apis.
         workflowExec.WorkflowInstance.DeadWorkflow = workflowExec;
     }
     for (int i = 0; i < eventList.Count; i++)
     {
         SchedulerLockGuardInfo eseg = eventList[i];
         // eseg.EventInfo is non-null only if the event type is Suspended or Terminated
         // If the event type is Suspended, then call FireWorkflowSuspended after casting
         //   the event argument to a String.
         // If the event type is Terminated, then call FireWorkflowTerminated after casting
         //   the event argument to either a String or an Exception.
         switch (eseg.EventType)
         {
             case WorkflowEventInternal.Suspended:
                 workflowExec.FireWorkflowSuspended((String)eseg.EventInfo);
                 break;
             case WorkflowEventInternal.Terminated:
                 if ((eseg.EventInfo as System.Exception) != null)
                 {
                     workflowExec.FireWorkflowTerminated((Exception)eseg.EventInfo);
                 }
                 else
                 {
                     workflowExec.FireWorkflowTerminated((String)eseg.EventInfo);
                 }
                 break;
             default:
                 workflowExec.FireWorkflowExecutionEvent(eseg.Sender, eseg.EventType);
                 break;
         }
     }
 }
Esempio n. 24
0
        private void OnActivityStatusChanged(object sender, WorkflowExecutor.ActivityStatusChangeEventArgs eventArgs)
        {
            if (this.isZombie || !this.isAttached)
                return;

            try
            {
                lock (this.eventLock)
                {
                    // We will receive an event when Activity.Execute() is about to be called.
                    if (eventArgs.Activity.ExecutionStatus == ActivityExecutionStatus.Executing)
                        return;

                    IWorkflowCoreRuntime workflowCoreRuntime = (IWorkflowCoreRuntime)sender;
                    Guid scheduleTypeId = GetScheduleTypeId(workflowCoreRuntime);

                    // When the activity starts executing, update its handler list for stepping.
                    if (eventArgs.Activity.ExecutionStatus == ActivityExecutionStatus.Executing)
                        EnumerateEventHandlersForActivity(scheduleTypeId, eventArgs.Activity);

                    this.controllerConduit.BeforeActivityStatusChanged(this.programId, scheduleTypeId, workflowCoreRuntime.InstanceID, eventArgs.Activity.QualifiedName, GetHierarchicalId(eventArgs.Activity), eventArgs.Activity.ExecutionStatus, GetContextId(eventArgs.Activity));
                    this.controllerConduit.ActivityStatusChanged(this.programId, scheduleTypeId, workflowCoreRuntime.InstanceID, eventArgs.Activity.QualifiedName, GetHierarchicalId(eventArgs.Activity), eventArgs.Activity.ExecutionStatus, GetContextId(eventArgs.Activity));
                }
            }
            catch
            {
                // Don't throw exceptions to the Runtime. Ignore exceptions that may occur if the debugger detaches 
                // and closes the remoting channel.
            }
        }
Esempio n. 25
0
 internal SchedulerLockGuard(InstanceLock il, WorkflowExecutor w)
 {
     lg = il.Enter();
     workflowExec = w;
 }
        private void WorkflowExecutionEvent(object sender, WorkflowExecutor.WorkflowExecutionEventArgs e)
        {
            switch (e.EventType)
            {
                case WorkflowEventInternal.Terminated:
                case WorkflowEventInternal.Aborted:
                case WorkflowEventInternal.Completed:
                {
                    WorkflowExecutor executor = (WorkflowExecutor) sender;
                    lock (this._listenerLock)
                    {
                        this._listeners.Remove(executor.ID);
                    }
                    break;
                }
                case WorkflowEventInternal.Aborting:
                    break;

                default:
                    return;
            }
        }
 public ScheduleWork(WorkflowExecutor executor)
 {
     this.oldValue = scheduleInfo;
     scheduleInfo = new ScheduleInfo(executor, false);
 }
 internal TrackingListener GetTrackingListener(Activity sked, WorkflowExecutor skedExec, TrackingListenerBroker broker)
 {
     if (!this._initialized)
     {
         this.Initialize(skedExec.WorkflowRuntime);
     }
     if (broker == null)
     {
         WorkflowTrace.Tracking.TraceEvent(TraceEventType.Error, 0, ExecutionStringManager.NullTrackingBroker);
         return null;
     }
     return this.GetListener(sked, skedExec, broker);
 }
 public ScheduleInfo(WorkflowExecutor executor, bool suppress)
 {
     this.suppress = suppress;
     this.scheduleWork = false;
     this.executor = executor;
 }
 internal void ReloadProfiles(WorkflowExecutor exec)
 {
     using (new ServiceEnvironment(exec.RootActivity))
     {
         using (exec.ExecutorLock.Enter())
         {
             if (!exec.IsInstanceValid)
             {
                 throw new InvalidOperationException(ExecutionStringManager.WorkflowNotValid);
             }
             bool flag = exec.Suspend(ExecutionStringManager.TrackingProfileUpdate);
             try
             {
                 this.GetListenerFromWRCache(exec.InstanceId).ReloadProfiles(exec, exec.InstanceId);
             }
             finally
             {
                 if (flag)
                 {
                     exec.Resume();
                 }
             }
         }
     }
 }