public TResult RetryUntilConnected <TResult>(Func <TResult> callable)
        {
            if (_zookeeperEventThread != null && Thread.CurrentThread == _zookeeperEventThread)
            {
                throw new Exception("Must not be done in the zookeeper event thread.");
            }

            while (true)
            {
                try
                {
                    return(callable());
                }
                catch (KeeperException.ConnectionLossException)
                {
                    // we give the event thread some time to update the status to 'Disconnected'
                    Thread.Yield();
                    WaitUntilConnected();
                }
                catch (KeeperException.SessionExpiredException)
                {
                    // we give the event thread some time to update the status to 'Expired'
                    Thread.Yield();
                    WaitUntilConnected();
                }
                catch (KeeperException e)
                {
                    throw ZkException.Create(e);
                }
                catch (ThreadInterruptedException e)
                {
                    throw new ZkInterruptedException(e);
                }
            }
        }
 public long GetCreationTime(String path)
 {
     try
     {
         EventLock.LockInterruptibly();
         return(_connection.GetCreateTime(path));
     }
     catch (KeeperException e)
     {
         throw ZkException.Create(e);
     }
     catch (ThreadInterruptedException e)
     {
         throw new ZkInterruptedException(e);
     }
     finally
     {
         EventLock.Unlock();
     }
 }