本文整理汇总了C#中IWorkItem.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IWorkItem.ToString方法的具体用法?C# IWorkItem.ToString怎么用?C# IWorkItem.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWorkItem
的用法示例。
在下文中一共展示了IWorkItem.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueueWorkItem
// Enqueue a work item to a given context
public void QueueWorkItem(IWorkItem workItem, ISchedulingContext context)
{
#if DEBUG
if (logger.IsVerbose2) logger.Verbose2("QueueWorkItem " + context);
#endif
if (workItem is TaskWorkItem)
{
var error = String.Format("QueueWorkItem was called on OrleansTaskScheduler for TaskWorkItem {0} on Context {1}."
+ " Should only call OrleansTaskScheduler.QueueWorkItem on WorkItems that are NOT TaskWorkItem. Tasks should be queued to the scheduler via QueueTask call.",
workItem.ToString(), context);
logger.Error(ErrorCode.SchedulerQueueWorkItemWrongCall, error);
throw new InvalidOperationException(error);
}
var workItemGroup = GetWorkItemGroup(context);
if (applicationTurnsStopped && (workItemGroup != null) && !workItemGroup.IsSystem)
{
// Drop the task on the floor if it's an application work item and application turns are stopped
var msg = string.Format("Dropping work item {0} because applicaiton turns are stopped", workItem);
logger.Warn(ErrorCode.SchedulerAppTurnsStopped, msg);
return;
}
workItem.SchedulingContext = context;
// We must wrap any work item in Task and enqueue it as a task to the right scheduler via Task.Start.
// This will make sure the TaskScheduler.Current is set correctly on any task that is created implicitly in the execution of this workItem.
if (workItemGroup == null)
{
Task t = TaskSchedulerUtils.WrapWorkItemAsTask(workItem, context, this);
t.Start(this);
}
else
{
// Create Task wrapper for this work item
Task t = TaskSchedulerUtils.WrapWorkItemAsTask(workItem, context, workItemGroup.TaskRunner);
t.Start(workItemGroup.TaskRunner);
}
}