Example #1
0
 @Override
 public void performBackgroundOperation(final OperationAndData<String> operationAndData)
     throws Exception {
   final TimeTrace trace = client.getZookeeperClient().startTracer("ExistsBuilderImpl-Background");
   AsyncCallback.StatCallback callback =
       new AsyncCallback.StatCallback() {
         @Override
         public void processResult(int rc, String path, Object ctx, Stat stat) {
           trace.commit();
           CuratorEvent event =
               new CuratorEventImpl(
                   CuratorEventType.EXISTS, rc, path, null, ctx, stat, null, null, null, null);
           client.processBackgroundOperation(operationAndData, event);
         }
       };
   if (watching.isWatched()) {
     client
         .getZooKeeper()
         .exists(operationAndData.getData(), true, callback, backgrounding.getContext());
   } else {
     client
         .getZooKeeper()
         .exists(
             operationAndData.getData(),
             watching.getWatcher(),
             callback,
             backgrounding.getContext());
   }
 }
Example #2
0
  @Override
  public Stat forPath(String path) throws Exception {
    path = client.fixForNamespace(path);

    Stat returnStat = null;
    if (backgrounding.inBackground()) {
      client.processBackgroundOperation(
          new OperationAndData<String>(this, path, backgrounding.getCallback()), null);
    } else {
      returnStat = pathInForeground(path);
    }

    return returnStat;
  }