コード例 #1
0
 /**
  * Set a node's data asynchronously.
  *
  * @param path
  * @param data
  * @param version
  * @param callback
  */
 public void setData(Object path, Object data, int version, final Closure callback) {
   zookeeper.setData(
       getPathAsString(path),
       serialize(data),
       version,
       new AsyncCallback.StatCallback() {
         public void processResult(int rc, String path, Object ctx, Stat stat) {
           callback.setDelegate(ctx);
           callback.setProperty("returnCode", rc);
           callback.setProperty("path", path);
           callback.call(stat);
         }
       },
       this);
 }
コード例 #2
0
 /**
  * Set a node's data.
  *
  * @param path
  * @param data
  * @param version
  * @return
  * @throws InterruptedException
  * @throws KeeperException
  */
 public Stat setData(Object path, Object data, int version)
     throws InterruptedException, KeeperException {
   return zookeeper.setData(getPathAsString(path), serialize(data), version);
 }