public virtual void Dispose() { if (_disposed) { return; } _disposed = true; _pool.Dispose(); PriorityQueue.Close(); }
public virtual void Dispose() { if (_disposed) { return; } _disposed = true; //NOTE: Wait all current running tasks to finish and after that dispose the objects DateTime timeOut = DateTime.Now.AddSeconds(Global.ConsumerDisposeTimeoutInSeconds); while (_messagesInProgressCount > 0 && DateTime.Now <= timeOut) { _watcher.InfoFormat("Wait for {0} messages on queue {1} in progress", _messagesInProgressCount, _queuePriorirty); Thread.Sleep(1000); } _pool.Dispose(); PriorityQueue.Close(); }