Ejemplo n.º 1
0
        protected virtual void RunActivity(CancellationToken token, Action <IWorkItem <T>, CancellationToken> activity)
        {
            using (var state = this.stateCallback())
            {
                if (state == null)
                {
                    this.Restart();
                    return;
                }

                Log.Verbose("Creating worker.");
                var worker = new TaskWorker <T>(state, token, this.minWorkers, this.maxWorkers);

                Log.Verbose("Starting activity.");
                activity(worker, token);
            }
        }
Ejemplo n.º 2
0
 protected static void Build()
 {
     worker = new TaskWorker <IMessagingChannel>(mockChannel.Object, tokenSource.Token, minWorkers, maxWorkers);
 }