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()));
        }
        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;
 }