private void DisposeResourcesWhoseDisposalCannotFail() { _disposing = true; lock (_newMessageArrivedLock) { Monitor.PulseAll(_newMessageArrivedLock); } if (_wasStarted) { _queuedMessagesSender.Stop(); _sendingThread.Join(); _receiver.Dispose(); } while (_currentlyInCriticalReceiveStatus > 0) { _logger.Info("Waiting for {0} messages that are currently in critical receive status", _currentlyInCriticalReceiveStatus); Thread.Sleep(TimeSpan.FromSeconds(1)); } while (_currentlyInsideTransaction > 0) { _logger.Info("Waiting for {0} transactions currently running", _currentlyInsideTransaction); Thread.Sleep(TimeSpan.FromSeconds(1)); } }
private void DisposeResourcesWhoseDisposalCannotFail() { disposing = true; lock (newMessageArrivedLock) { Monitor.PulseAll(newMessageArrivedLock); } if (wasStarted) { purgeOldDataTimer.Dispose(); queuedMessagesSender.Stop(); sendingThread.Join(); receiver.Dispose(); } while (currentlyInCriticalReceiveStatus > 0) { logger.WarnFormat("Waiting for {0} messages that are currently in critical receive status", currentlyInCriticalReceiveStatus); Thread.Sleep(TimeSpan.FromSeconds(1)); } while (currentlyInsideTransaction > 0) { logger.WarnFormat("Waiting for {0} transactions currently running", currentlyInsideTransaction); Thread.Sleep(TimeSpan.FromSeconds(1)); } }