public void Dispose()
        {
            if (_connection == null)
            {
                return;
            }

            Logger.Debug("Closing ZkClient...");
            EventLock.Lock();
            try
            {
                ShutdownTrigger = true;
                _eventThread.Interrupt();
                _eventThread.Join(2000);
                _connection.Dispose();
                _connection = null;
            }
            catch (ThreadInterruptedException e)
            {
                throw new ZkInterruptedException(e);
            }
            finally
            {
                EventLock.Unlock();
            }

            Logger.Debug("Closing ZkClient...done");
        }
 public ZkClient(IZkConnection zkConnection, int connectionTimeout, IZkSerializer zkSerializer)
 {
     this._connection  = zkConnection;
     this.ZkSerializer = zkSerializer;
     this.EventLock    = new ZkLock();
     this.Connect(connectionTimeout, this);
 }
 public ZkClient(IZkConnection connection, int connectionTimeout)
     : this(connection, connectionTimeout, null)
 {
 }
 public ZkClient(IZkConnection connection)
     : this(connection, int.MaxValue)
 {
 }