本文整理汇总了C#中IWorkItemsGroup类的典型用法代码示例。如果您正苦于以下问题:C# IWorkItemsGroup类的具体用法?C# IWorkItemsGroup怎么用?C# IWorkItemsGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWorkItemsGroup类属于命名空间,在下文中一共展示了IWorkItemsGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateWorkItem
/// <summary>
/// Create a new work item
/// </summary>
/// <param name = "wigStartInfo">Work item group start information</param>
/// <param name = "callback">A callback to execute</param>
/// <returns>Returns a work item</returns>
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
WorkItemCallback callback)
{
return CreateWorkItem(workItemsGroup, wigStartInfo, callback, null);
}
示例2: AsyncService
/// <summary>
/// 实例化QueueService
/// </summary>
/// <param name="smart"></param>
/// <param name="logger"></param>
/// <param name="service"></param>
/// <param name="elapsedTime"></param>
public AsyncService(IWorkItemsGroup group, ILog logger, IService service, TimeSpan elapsedTime)
{
this.smart = group;
this.logger = logger;
this.service = service;
this.elapsedTime = elapsedTime;
}
示例3: HttpServiceCaller
/// <summary>
/// HttpServiceCaller初始化
/// </summary>
/// <param name="group"></param>
/// <param name="config"></param>
/// <param name="container"></param>
public HttpServiceCaller(IWorkItemsGroup group, CastleServiceConfiguration config, IServiceContainer container)
{
this.config = config;
this.container = container;
this.smart = group;
this.callers = new HttpCallerInfoCollection();
this.callTimeouts = new Dictionary<string, int>();
}
示例4: QuickSort
/// <summary>
/// QuickSort array using wig to parallel the sort
/// </summary>
/// <param name="wig">A IWorkItemsGroup to use to parallel the sort</param>
/// <param name="array">The array of items to sort</param>
public static void QuickSort(IWorkItemsGroup wig, int[] array)
{
// Initiate the QuickSort
wig.QueueWorkItem(QuickSort, wig, array, 0, array.Length - 1);
// Wait for the sort to complete.
wig.WaitForIdle();
}
示例5: WigEntry
public WigEntry(
IWorkItemsGroup wig,
QueueUsageControl queueUsageControl,
Label isIdle)
{
_wig = wig;
_queueUsageControl = queueUsageControl;
_isIdle = isIdle;
}
示例6: WorkGroupWithItem
/// <summary>
/// Initializes a new instance of the <see cref="WorkGroupWithItem"/> class.
/// </summary>
/// <param name="sourceGroup">The source group.</param>
/// <param name="threadGroup">The thread group.</param>
/// <param name="metricCounter">A counter for tracking how many items are being processed</param>
public WorkGroupWithItem(IWorkGroup sourceGroup, IWorkItemsGroup threadGroup, ICounter metricCounter)
{
Guard.NotNull(() => sourceGroup, sourceGroup);
Guard.NotNull(() => threadGroup, threadGroup);
Guard.NotNull(() => metricCounter, metricCounter);
GroupInfo = sourceGroup;
Group = threadGroup;
MaxWorkItems = GroupInfo.ConcurrencyLevel + GroupInfo.MaxQueueSize;
MetricCounter = metricCounter;
}
示例7: TestQueueWorkItemCall
//IWorkItemResult QueueWorkItem(WorkItemCallback callback);
public static void TestQueueWorkItemCall(IWorkItemsGroup wig)
{
WorkItemInfo wii = new WorkItemInfo();
WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii);
IWorkItemResult wir = wig.QueueWorkItem(wiic.CompareWorkItemInfo);
bool success = (bool)wir.Result;
Assert.IsTrue(success);
}
示例8: TestQueueWorkItemCallStat
//IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state);
public static void TestQueueWorkItemCallStat(IWorkItemsGroup wig)
{
object state = new object();
WorkItemInfo wii = new WorkItemInfo();
WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii, state);
IWorkItemResult wir = wig.QueueWorkItem((WorkItemCallback) wiic.CompareWorkItemInfo, state);
bool success = (bool)wir.Result;
Assert.IsTrue(success);
}
示例9: TestQueueWorkItemCallPrio
//IWorkItemResult QueueWorkItem(WorkItemCallback callback, WorkItemPriority workItemPriority);
public static void TestQueueWorkItemCallPrio(IWorkItemsGroup wig)
{
WorkItemInfo wii = new WorkItemInfo();
wii.WorkItemPriority = WorkItemPriority.AboveNormal;
WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii);
IWorkItemResult wir = wig.QueueWorkItem((WorkItemCallback)wiic.CompareWorkItemInfo, WorkItemPriority.AboveNormal);
bool success = (bool)wir.Result;
Assert.IsTrue(success);
}
示例10: TestQueueWorkItemCallStatPrio
//IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, WorkItemPriority workItemPriority);
public static void TestQueueWorkItemCallStatPrio(IWorkItemsGroup wig)
{
object state = new object();
WorkItemInfo wii = new WorkItemInfo();
wii.WorkItemPriority = WorkItemPriority.AboveNormal;
WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii, state);
IWorkItemResult wir = wig.QueueWorkItem(wiic.CompareWorkItemInfo, state, WorkItemPriority.AboveNormal);
bool success = (bool)wir.Result;
Assert.IsTrue(success);
}
示例11: CreateWorkItem
// Token: 0x0600185F RID: 6239
// RVA: 0x00075274 File Offset: 0x00073474
public static WorkItem CreateWorkItem(IWorkItemsGroup iworkItemsGroup_0, WIGStartInfo wigstartInfo_0, WorkItemCallback workItemCallback_0, object object_0, WorkItemPriority workItemPriority_0)
{
WorkItemFactory.ValidateCallback(workItemCallback_0);
return new WorkItem(iworkItemsGroup_0, new WorkItemInfo
{
UseCallerCallContext = wigstartInfo_0.UseCallerCallContext,
UseCallerHttpContext = wigstartInfo_0.UseCallerHttpContext,
PostExecuteWorkItemCallback = wigstartInfo_0.PostExecuteWorkItemCallback,
CallToPostExecute = wigstartInfo_0.CallToPostExecute,
DisposeOfStateObjects = wigstartInfo_0.DisposeOfStateObjects,
WorkItemPriority = workItemPriority_0
}, workItemCallback_0, object_0);
}
示例12: ServiceCaller
/// <summary>
/// 初始化ServiceCaller
/// </summary>
/// <param name="group"></param>
/// <param name="status"></param>
public ServiceCaller(IWorkItemsGroup group, ServerStatusService status)
{
this.status = status;
this.smart = group;
this.callbackTypes = new Dictionary<string, Type>();
this.callTimeouts = new Dictionary<string, int>();
//初始化服务
InitServiceCaller(status.Container);
//注册状态服务
var hashtable = new Dictionary<Type, object>();
hashtable[typeof(IStatusService)] = status;
//注册组件
status.Container.RegisterComponents(hashtable);
}
示例13: Concurrency
private void Concurrency(
int concurrencyPerWig,
int wigsCount,
int workItemsCount)
{
Console.WriteLine(
"Testing : concurrencyPerWig = {0}, wigsCount = {1}, workItemsCount = {2}",
concurrencyPerWig,
wigsCount,
workItemsCount);
_success = true;
_concurrencyPerWig = concurrencyPerWig;
_randGen = new Random(0);
STPStartInfo stpStartInfo = new STPStartInfo();
stpStartInfo.StartSuspended = true;
SmartThreadPool stp = new SmartThreadPool(stpStartInfo);
_concurrentOps = new int[wigsCount];
IWorkItemsGroup [] wigs = new IWorkItemsGroup[wigsCount];
for(int i = 0; i < wigs.Length; ++i)
{
wigs[i] = stp.CreateWorkItemsGroup(_concurrencyPerWig);
for(int j = 0; j < workItemsCount; ++j)
{
wigs[i].QueueWorkItem(new WorkItemCallback(this.DoWork), i);
}
wigs[i].Start();
}
stp.Start();
stp.WaitForIdle();
Assert.IsTrue(_success);
stp.Shutdown();
}
示例14: TestQueueWorkItemCallStatPost
//IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback);
public static void TestQueueWorkItemCallStatPost(IWorkItemsGroup wig)
{
bool postExecuteCalled = false;
object state = new object();
PostExecuteWorkItemCallback postExecuteWorkItemCallback = delegate(IWorkItemResult w) { postExecuteCalled = true; };
WorkItemInfo wii = new WorkItemInfo();
wii.PostExecuteWorkItemCallback = postExecuteWorkItemCallback;
WorkItemInfoComparer wiic = new WorkItemInfoComparer(wii, state);
IWorkItemResult wir = wig.QueueWorkItem(
wiic.CompareWorkItemInfo,
state,
postExecuteWorkItemCallback);
// We must wait for idle to let the post execute run
wig.WaitForIdle();
bool success = (bool)wir.Result;
Assert.IsTrue(success);
Assert.IsTrue(postExecuteCalled);
}
示例15: CreateWorkItem
/// <summary>
/// Create a new work item
/// </summary>
/// <param name="workItemsGroup"></param>
/// <param name="wigStartInfo">Work item group start information</param>
/// <param name="callback">A callback to execute</param>
/// <param name="state">
/// The context object of the work item. Used for passing arguments to the work item.
/// </param>
/// <returns>Returns a work item</returns>
public static WorkItem CreateWorkItem(
IWorkItemsGroup workItemsGroup,
WIGStartInfo wigStartInfo,
WorkItemCallback callback,
object state)
{
ValidateCallback(callback);
WorkItemInfo workItemInfo = new WorkItemInfo();
workItemInfo.UseCallerCallContext = wigStartInfo.UseCallerCallContext;
workItemInfo.UseCallerHttpContext = wigStartInfo.UseCallerHttpContext;
workItemInfo.PostExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback;
workItemInfo.CallToPostExecute = wigStartInfo.CallToPostExecute;
workItemInfo.DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects;
WorkItem workItem = new WorkItem(
workItemsGroup,
workItemInfo,
callback,
state);
return workItem;
}