コード例 #1
0
        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");
        }
コード例 #2
0
 private void Reconnect()
 {
     EventLock.Lock();
     try
     {
         _connection.Dispose();
         _connection.Connect(this);
     }
     catch (ThreadInterruptedException e)
     {
         throw new ZkInterruptedException(e);
     }
     finally
     {
         EventLock.Unlock();
     }
 }