/// <summary> /// Disposes of or finalises the object. /// </summary> /// <param name="disposing"></param> private void Dispose(bool disposing) { if (disposing) { lock (_SyncLock) _Disposed = true; foreach (var client in _ConnectedClients.ToArray()) { try { DisconnectClient(client); } catch { } } _ConnectedClients.Clear(); if (_SendQueue != null) { _SendQueue.Dispose(); _SendQueue = null; } if (_Listener != null) { try { _Listener.Stop(); _Listener = null; } catch { } } } }
/// <summary> /// See interface docs. /// </summary> public void Shutdown() { if (_BackgroundThreadMessageQueue != null) { _BackgroundThreadMessageQueue.Dispose(); } EndSession(); }
/// <summary> /// See interface docs. /// </summary> public void Shutdown() { if (_OnlineLookupCache != null) { _OnlineLookupCache.Enabled = false; } if (_BackgroundThreadMessageQueue != null) { _BackgroundThreadMessageQueue.Dispose(); } if (_HeartbeatService != null) { _HeartbeatService.SlowTick -= Heartbeat_SlowTick; _HeartbeatService.Dispose(); } EndSession(); }
/// <summary> /// Disposes of or finalises the object. /// </summary> /// <param name="disposing"></param> private void Dispose(bool disposing) { _Disposed = true; if (disposing) { lock (_SyncLock) { if (Provider != null) { Provider.Close(); } if (_MessageProcessingAndDispatchQueue != null) { _MessageProcessingAndDispatchQueue.Dispose(); } if (RawMessageTranslator != null) { RawMessageTranslator.Dispose(); } } } }
/// <summary> /// Disposes of or finalises the object. /// </summary> /// <param name="disposing"></param> private void Dispose(bool disposing) { _Disposed = true; if (disposing) { lock (_SyncLock) { if (Connector != null) { Connector.CloseConnection(); UnhookConnector(); Connector.Dispose(); } if (_MessageProcessingAndDispatchQueue != null) { _MessageProcessingAndDispatchQueue.Dispose(); } if (RawMessageTranslator != null) { RawMessageTranslator.Dispose(); } } } }
private void DoAbandon(bool raiseExceptionEvent) { var inAbandon = false; BackgroundThreadQueue <ReadWriteOperation> operationQueue = null; lock (_SyncLock) { inAbandon = _InAbandon; if (!inAbandon) { _InAbandon = true; operationQueue = _OperationQueue; _OperationQueue = null; } } if (!inAbandon) { try { try { AbandonConnection(); } catch (Exception ex) { if (_Connector != null && raiseExceptionEvent) { _Connector.RaiseConnectionException(this, ex); } } if (operationQueue != null) { // This will throw a ThreadAborted exception - any code outside of a catch or finally // after this point will not run. operationQueue.Dispose(); } } finally { _InAbandon = false; } } }