本文整理汇总了C#中IWorker.Start方法的典型用法代码示例。如果您正苦于以下问题:C# IWorker.Start方法的具体用法?C# IWorker.Start怎么用?C# IWorker.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWorker
的用法示例。
在下文中一共展示了IWorker.Start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start()
{
// load the agent info
Log.Debug("Loading agent context");
AgentContext.Load();
if (AgentContext.Current == null)
{
throw new ApplicationException("Agent configuration could not be loaded");
}
if (string.IsNullOrEmpty(AgentContext.Current.ServerKey))
{
throw new ApplicationException("Agent server key not available");
}
// load workers
Log.Debug("Loading agent worker threads");
MetricsWorker = DependencyRegistry.Resolve<MetricsWorker>();
DiscoveryWorker = DependencyRegistry.Resolve<DiscoveryWorker>();
SyncWorker = DependencyRegistry.Resolve<SyncWorker>();
// initialize workers
DiscoveryWorker.Initialize();
MetricsWorker.Initialize();
SyncWorker.Initialize();
// start workers
Log.Debug("Starting agent worker threads");
DiscoveryWorker.Start();
MetricsWorker.Start();
SyncWorker.Start();
}
示例2: ExecuteWorker
/// <summary>
/// Executes the worker.
/// </summary>
/// <param name="worker">The worker.</param>
private void ExecuteWorker(IWorker worker)
{
Logger.Info("Begining execution of worker {0}", worker.Name);
_workerList.Add(worker);
worker.Start();
}