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()));
        }
Beispiel #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()));
        }
        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;
            }
        }
Beispiel #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));
        }
Beispiel #5
0
 public WorkerPoolInfo(WorkerPool <T> workerPool, ISequenceBarrier barrier)
 {
     _workerPool  = workerPool;
     Barrier      = barrier;
     IsEndOfChain = true;
 }
Beispiel #6
0
 public WorkerPoolInfo(WorkerPool <T> workerPool, ISequenceBarrier sequenceBarrier)
 {
     this.workerPool      = workerPool;
     this.sequenceBarrier = sequenceBarrier;
 }