public void ScheduleItem(SchedulableItem s, bool isInAtomicTransaction, bool transacted) { lock (this.syncObject) { WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 1, "Workflow Runtime: Scheduler: InstanceId: {0} : Scheduling entry: {1}", new object[] { this.RootWorkflowExecutor.InstanceIdString, s.ToString() }); (isInAtomicTransaction ? this.highPriorityEntriesQueue : this.normalPriorityEntriesQueue).Enqueue(s); if (transacted) { if (this.transactedEntries == null) { this.transactedEntries = new Queue<SchedulableItem>(); } this.transactedEntries.Enqueue(s); } if (!this.threadRequested && this.CanRun) { this.RootWorkflowExecutor.ScheduleForWork(); this.threadRequested = true; } this.empty = false; } }
void IWorkflowCoreRuntime.ScheduleItem(SchedulableItem item, bool isInAtomicTransaction, bool transacted, bool queueInTransaction) { if (!ServiceEnvironment.IsInServiceThread(this.InstanceId)) throw new InvalidOperationException(ExecutionStringManager.MustUseRuntimeThread); if (!queueInTransaction) this.Scheduler.ScheduleItem(item, isInAtomicTransaction, transacted); else this.AddItemToBeScheduledLater(this.CurrentActivity, item); }
private void AddItemToBeScheduledLater(Activity atomicActivity, SchedulableItem item) { if (atomicActivity == null) return; // Activity may not be atomic and is an activity which is not // yet scheduled for execution (typically receive case) if (!atomicActivity.SupportsTransaction) return; TransactionalProperties transactionalProperties = (TransactionalProperties)atomicActivity.GetValue(TransactionalPropertiesProperty); if (transactionalProperties != null) { lock (transactionalProperties) { List<SchedulableItem> notifications = null; notifications = transactionalProperties.ItemsToBeScheduledAtCompletion; if (notifications == null) { notifications = new List<SchedulableItem>(); transactionalProperties.ItemsToBeScheduledAtCompletion = notifications; } notifications.Add(item); } } }
private void AddItemToBeScheduledLater(Activity atomicActivity, SchedulableItem item) { if ((atomicActivity != null) && atomicActivity.SupportsTransaction) { TransactionalProperties properties = (TransactionalProperties) atomicActivity.GetValue(TransactionalPropertiesProperty); if (properties != null) { lock (properties) { List<SchedulableItem> itemsToBeScheduledAtCompletion = null; itemsToBeScheduledAtCompletion = properties.ItemsToBeScheduledAtCompletion; if (itemsToBeScheduledAtCompletion == null) { itemsToBeScheduledAtCompletion = new List<SchedulableItem>(); properties.ItemsToBeScheduledAtCompletion = itemsToBeScheduledAtCompletion; } itemsToBeScheduledAtCompletion.Add(item); } } } }
public void ScheduleItem(SchedulableItem item, bool isInAtomicTransaction) { Queue<SchedulableItem> queue = isInAtomicTransaction ? this.atomicActivityQueue : this.schedulerQueue; queue.Enqueue(item); }
public void ScheduleItem(SchedulableItem item, bool isInAtomicTransaction, bool transacted, bool queueInTransaction) { if (queueInTransaction) { this.AddItemToBeScheduledLater(this.CurrentActivity, item); } else { this.scheduler.ScheduleItem(item, isInAtomicTransaction); } }