public EventHandlerGroup <T> CreateWorkerPool(Sequence[] barrierSequences, IWorkHandler <T>[] workHandlers)
        {
            var sequenceBarrier = ringBuffer.NewBarrier(barrierSequences);
            var workerPool      = new WorkerPool <T>(ringBuffer, sequenceBarrier, exceptionHandler, workHandlers);

            consumerRepository.Add(workerPool, sequenceBarrier);
            return(new EventHandlerGroup <T>(this, consumerRepository, workerPool.getWorkerSequences()));
        }
Пример #2
0
        internal EventHandlerGroup <T> CreateWorkerPool(ISequence[] barrierSequences, IWorkHandler <T>[] workHandlers)
        {
            var sequenceBarrier = _ringBuffer.NewBarrier(barrierSequences);
            var workerPool      = new WorkerPool <T>(_ringBuffer, sequenceBarrier, _exceptionHandler, workHandlers);

            _consumerRepository.Add(workerPool, sequenceBarrier);

            return(new EventHandlerGroup <T>(this, _consumerRepository, workerPool.GetWorkerSequences()));
        }
Пример #3
0
        public void Add(WorkerPool <T> workerPool, ISequenceBarrier barrier)
        {
            var workerPoolInfo = new WorkerPoolInfo <T>(workerPool, barrier);

            _consumerInfos.Add(workerPoolInfo);
            foreach (var sequence in workerPool.GetWorkerSequences())
            {
                _eventProcessorInfoBySequence[sequence] = workerPoolInfo;
            }
        }
Пример #4
0
        public EventHandlerGroup <T> CreateWorkerPool(
            ISequence[] barrierSequences, IWorkHandler <T>[] workHandlers)
        {
            var barrier    = _ringBuffer.NewBarrier(barrierSequences);
            var workerPool = new WorkerPool <T>(_ringBuffer, barrier, _exceptionHandler, workHandlers);

            _consumerRepository.Add(workerPool, barrier);
            var workerSequences = workerPool.GetWorkerSequences();

            UpdateGatingSequencesForNextInChain(barrierSequences, workerSequences);

            return(new EventHandlerGroup <T>(this, _consumerRepository, workerSequences));
        }
Пример #5
0
 public WorkerPoolInfo(WorkerPool <T> workerPool, ISequenceBarrier barrier)
 {
     _workerPool  = workerPool;
     Barrier      = barrier;
     IsEndOfChain = true;
 }
Пример #6
0
 public WorkerPoolInfo(WorkerPool <T> workerPool, ISequenceBarrier sequenceBarrier)
 {
     this.workerPool      = workerPool;
     this.sequenceBarrier = sequenceBarrier;
 }