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); } }
protected static void Build() { worker = new TaskWorker <IMessagingChannel>(mockChannel.Object, tokenSource.Token, minWorkers, maxWorkers); }