private static int Dequeue(IZooKeeper zk, string path, IReadOnlyList<string> nodes)
        {
            Stat stat = null;

            //Get minimum node
            var minstr = GetMinimumNode(nodes);

            var b = zk.GetData(path + "/element" + minstr, false, stat);

            zk.Delete(path + "/element" + minstr, 0);

            var buffer = Convert.ToInt32(b.First());
            var retvalue = buffer;
            return retvalue;
        }
Beispiel #2
0
        private static int Dequeue(IZooKeeper zk, string path, IReadOnlyList <string> nodes)
        {
            Stat stat = null;

            //Get minimum node
            var minstr = GetMinimumNode(nodes);

            var b = zk.GetData(path + "/element" + minstr, false, stat);

            zk.Delete(path + "/element" + minstr, 0);

            var buffer   = Convert.ToInt32(b.First());
            var retvalue = buffer;

            return(retvalue);
        }
Beispiel #3
0
 /// <summary>
 /// Attempt to delete the lock node so that sequence numbers get reset.
 /// </summary>
 public void Clean()
 {
     try
     {
         // Don't blindly do delete or things get noisy in the INFO logs on the
         // server.
         var stat = _client.Exists(_basePath, false);
         if (null != stat && stat.NumChildren < 1)
         {
             _client.Delete(_basePath, -1);
         }
     }
     catch (KeeperException.BadVersionException)
     {
         // Intentially ignore this - another thread/process got the lock
     }
     catch (KeeperException.NotEmptyException)
     {
         // Intentially ignore this - other threads/processes are waiting
     }
 }