示例#1
0
        public void AddWorker(IResponderWorker worker, IMessage requestMessage, object state)
        {
            if (worker == null)
            {
                throw new ArgumentNullException("worker");
            }
            if (_disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            var responderWorkerWithState = new ResponderWorkerWithState(worker, requestMessage, state);

            _workers.Add(responderWorkerWithState, _disposedToken);

            IncreaseWorkerThreadsIfNeeded();
        }
        public void AddWorker(IResponderWorker worker, IMessage requestMessage, object state)
        {
            if (worker == null) throw new ArgumentNullException("worker");
            if (_disposed) throw new ObjectDisposedException(GetType().FullName);

            var responderWorkerWithState = new ResponderWorkerWithState(worker, requestMessage, state);
            _workers.Add(responderWorkerWithState, _disposedToken);

            IncreaseWorkerThreadsIfNeeded();
        }