/// <summary> /// Initializes a new instance of the <see cref="PoolHandler"/> class. /// </summary> /// <param name="queueManager">The queue manager.</param> /// <param name="handler">The handler.</param> /// <param name="errorHandler">The error handler.</param> public PoolHandler(QueueManager queueManager, AsyncEventHandler handler, ErrorHandler errorHandler) { _queueManager = queueManager; _executionEngine = new ThreadPoolQueueExecutionEngine(_queueManager.Configuration); _executionEngine.OnThreadUsageChanged += (EventHandler) ((sender, args) => _queueManager.Counters.ThreadsInUse = (long) _executionEngine.ThreadsInUse); _handler = handler; _errorHandler = errorHandler; }
/// <summary> /// Initializes the queue manager. /// </summary> /// <param name="config">The configuration.</param> private void InitializeQueueManager(IConfiguration config) { var hostHandler = new AsyncHostHandler(this); QueueManager = new QueueManager(ServiceName, OperationsFactory, PerformanceCounters, config, new QueueDataAccessFactory(), this._errorHandler, MyEventLog); QueueManager.RegisterEventHandler(new AsyncEventHandler(hostHandler.Handle)); QueueManager.AsyncOperationStatusChanged += this.OnAsyncOperationStatusChanged; }