public void Dispose() { if (_connection != null) { _connection.connection.OnFailure -= ConnectionOnOnFailure; _connection = null; } if (appendConnections.Length > 0) { lock (this) { var connections = appendConnections; foreach (var c in connections.Where(x => x != null)) { c.connection.OnFailure -= ConnectionOnOnFailure; _cluster.DisposeConnection(c.connection); } appendConnections = new connectionInfo[] { }; } } }