public Responder(IResponderWorkerFactory responderWorkerFactory, IMessageSerialization messageSerialization, int minThreads = 1, int maxThreads = 1) { if (responderWorkerFactory == null) throw new ArgumentNullException("responderWorkerFactory"); if (messageSerialization == null) throw new ArgumentNullException("messageSerialization"); _responderWorkerFactory = responderWorkerFactory; _messageSerialization = messageSerialization; _disposeCancellationTokenSource = new CancellationTokenSource(); _disposeCancellationToken = _disposeCancellationTokenSource.Token; _servers = new ConcurrentDictionary<RedFoxEndpoint, ISocketAccepter>(); _clientSockets = new ConcurrentDictionary<ISocket, SenderReceiver>(); _scheduler = new ResponderWorkerScheduler(minThreads, maxThreads); _scheduler.WorkerCompleted += SchedulerWorkerCompleted; _messageFrameCreator = new MessageFrameCreator(messageSerialization); }
public Responder(IResponderWorkerFactory responderWorkerFactory, IMessageSerialization messageSerialization, int minThreads = 1, int maxThreads = 1) { if (responderWorkerFactory == null) { throw new ArgumentNullException("responderWorkerFactory"); } if (messageSerialization == null) { throw new ArgumentNullException("messageSerialization"); } _responderWorkerFactory = responderWorkerFactory; _messageSerialization = messageSerialization; _disposeCancellationTokenSource = new CancellationTokenSource(); _disposeCancellationToken = _disposeCancellationTokenSource.Token; _servers = new ConcurrentDictionary <RedFoxEndpoint, ISocketAccepter>(); _clientSockets = new ConcurrentDictionary <ISocket, SenderReceiver>(); _scheduler = new ResponderWorkerScheduler(minThreads, maxThreads); _scheduler.WorkerCompleted += SchedulerWorkerCompleted; _messageFrameCreator = new MessageFrameCreator(messageSerialization); }