/// <summary> /// Close this client object. Once the client is closed, its session becomes /// invalid. All the ephemeral nodes in the ZooKeeper server associated with /// the session will be removed. The watches left on those nodes (and on /// their parents) will be triggered. /// </summary> private void InternalDispose() { var connectionState = State; if (null != connectionState && !connectionState.IsAlive()) { if (log.IsDebugEnabled) { log.Debug("Close called on already closed client"); } return; } if (log.IsDebugEnabled) { log.DebugFormat("Closing session: 0x{0:X}", SessionId); } try { cnxn.Dispose(); } catch (Exception e) { if (log.IsDebugEnabled) { log.Debug("Ignoring unexpected exception during close", e); } } log.DebugFormat("Session: 0x{0:X} closed", SessionId); }
/// <summary> /// Close this client object. Once the client is closed, its session becomes /// invalid. All the ephemeral nodes in the ZooKeeper server associated with /// the session will be removed. The watches left on those nodes (and on /// their parents) will be triggered. /// </summary> private void InternalDispose() { //Assume an unitialized connection state could still require a connection disposal var connectionState = State; if (null != connectionState && !connectionState.IsAlive()) { if (LOG.IsDebugEnabled) { LOG.Debug("Close called on already closed client"); } return; } if (LOG.IsDebugEnabled) { LOG.DebugFormat("Closing session: 0x{0:X}", SessionId); } try { cnxn.Dispose(); } catch (Exception e) { if (LOG.IsDebugEnabled) { LOG.Debug("Ignoring unexpected exception during close", e); } } LOG.DebugFormat("Session: 0x{0:X} closed", SessionId); }
public void Dispose() { if (!state.IsAlive()) { if (LOG.IsDebugEnabled) { LOG.Debug("Close called on already closed client"); } return; } if (LOG.IsDebugEnabled) { LOG.Debug(string.Format("Closing session: 0x{0:X}", SessionId)); } try { cnxn.Dispose(); } catch (IOException e) { if (LOG.IsDebugEnabled) { LOG.Debug("Ignoring unexpected exception during close", e); } } LOG.Info(string.Format("Session: 0x{0:X} closed", SessionId)); }
public static void Main(String[] args) { bool run = true; IClient client = new ReactiveIRC.Client.Client(); IClientConnection connection = client.CreateClientConnection(args[0], Convert.ToUInt16(args[1]), null); connection.ReceivedMessages.Subscribe(PrintMessage); connection.Connect().Subscribe( _ => {}, e => _logger.ErrorException("Error connecting.", e), () => connection.Login(args[2], args[3], args[4], args[5]).Subscribe() ); Console.CancelKeyPress += delegate { connection.Dispose(); run = false; }; while (run) { Thread.Sleep(50); } }
public void Dispose() { _connection?.Dispose(); }
public void Dispose() { _connection.Dispose(); _subscription.Dispose(); }