public VerificationWorker(string name, ICoordinator coordinator, int maxConcurrentVerifications)
        {
            Ensure.NotNullOrEmpty(name, "name");
            Ensure.NotNull(coordinator, "coordinator");

            _worker = new Worker(name, coordinator, WorkerRole.Verifier, maxConcurrentVerifications, OnPackageArrived, Pack);
        }
Esempio n. 2
0
 public WriteWorker(string name, ICoordinator coordinator, int maxconcurrentWrites)
 {
     _worker = new Worker(name, coordinator, WorkerRole.Writer, maxconcurrentWrites, OnPackageArrived, Pack);
 }
        private bool Run(CommandProcessorContext context, int threads, int tasks)
        {
            context.IsAsync();

            var done = new AutoResetEvent(false);

            var coordinator = new Coordinator(context, _producers, tasks, done);
            coordinator.Start();

            var workers = new Worker[threads];

            for (var i = 0; i < workers.Length; i++)
                workers[i] = new Worker(i.ToString(), coordinator, context.Client.Options.WriteWindow);
            foreach (var worker in workers)
                worker.Start();

            done.WaitOne();

            foreach (var worker in workers)
                worker.Stop();

            context.Success();
            return true;
        }