Examples of ChildrenCallback


Examples of org.apache.zookeeper.AsyncCallback.ChildrenCallback

                      } else {
                          cb.processResult(rc, clientPath, p.ctx, null,
                                  null);
                      }
                  } else if (p.response instanceof GetChildrenResponse) {
                      ChildrenCallback cb = (ChildrenCallback) p.cb;
                      GetChildrenResponse rsp = (GetChildrenResponse) p.response;
                      if (rc == 0) {
                          cb.processResult(rc, clientPath, p.ctx, rsp
                                  .getChildren());
                      } else {
                          cb.processResult(rc, clientPath, p.ctx, null);
                      }
                  } else if (p.response instanceof GetChildren2Response) {
                      Children2Callback cb = (Children2Callback) p.cb;
                      GetChildren2Response rsp = (GetChildren2Response) p.response;
                      if (rc == 0) {
                          cb.processResult(rc, clientPath, p.ctx, rsp
                                  .getChildren(), rsp.getStat());
                      } else {
                          cb.processResult(rc, clientPath, p.ctx, null, null);
                      }
                  } else if (p.response instanceof CreateResponse) {
                      StringCallback cb = (StringCallback) p.cb;
                      CreateResponse rsp = (CreateResponse) p.response;
                      if (rc == 0) {
                          cb.processResult(rc, clientPath, p.ctx,
                                  (chrootPath == null
                                          ? rsp.getPath()
                                          : rsp.getPath()
                                    .substring(chrootPath.length())));
                      } else {
                          cb.processResult(rc, clientPath, p.ctx, null);
                      }
                  } else if (p.response instanceof Create2Response) {
                    Create2Callback cb = (Create2Callback) p.cb;
                      Create2Response rsp = (Create2Response) p.response;
                      if (rc == 0) {
                          cb.processResult(rc, clientPath, p.ctx,
                                  (chrootPath == null
                                          ? rsp.getPath()
                                          : rsp.getPath()
                                    .substring(chrootPath.length())), rsp.getStat());
                      } else {
                          cb.processResult(rc, clientPath, p.ctx, null, null);
                      }                  
                  } else if (p.response instanceof MultiResponse) {
                    MultiCallback cb = (MultiCallback) p.cb;
                    MultiResponse rsp = (MultiResponse) p.response;
                    if (rc == 0) {
                      List<OpResult> results = rsp.getResultList();
                      int newRc = rc;
                      for (OpResult result : results) {
                        if (result instanceof ErrorResult
                            && KeeperException.Code.OK.intValue() != (newRc = ((ErrorResult) result)
                            .getErr())) {
                          break;
                        }
                      }
                      cb.processResult(newRc, clientPath, p.ctx, results);
                    } else {
                      cb.processResult(rc, clientPath, p.ctx, null);
                    }
                  }  else if (p.cb instanceof VoidCallback) {
                      VoidCallback cb = (VoidCallback) p.cb;
                      cb.processResult(rc, clientPath, p.ctx);
                  }
              }
          } catch (Throwable t) {
              LOG.error("Caught unexpected throwable", t);
          }
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.AsyncCallback.ChildrenCallback

                                    rsp.getAcl(), rsp.getStat());
                        } else {
                            cb.processResult(rc, clientPath, p.ctx, null, null);
                        }
                    } else if (p.response instanceof GetChildrenResponse) {
                        ChildrenCallback cb = (ChildrenCallback) p.cb;
                        GetChildrenResponse rsp = (GetChildrenResponse) p.response;
                        if (rc == 0) {
                            cb.processResult(rc, clientPath, p.ctx,
                                    rsp.getChildren());
                        } else {
                            cb.processResult(rc, clientPath, p.ctx, null);
                        }
                    } else if (p.response instanceof GetChildren2Response) {
                        Children2Callback cb = (Children2Callback) p.cb;
                        GetChildren2Response rsp = (GetChildren2Response) p.response;
                        if (rc == 0) {
                            cb.processResult(rc, clientPath, p.ctx,
                                    rsp.getChildren(), rsp.getStat());
                        } else {
                            cb.processResult(rc, clientPath, p.ctx, null, null);
                        }
                    } else if (p.response instanceof CreateResponse) {
                        StringCallback cb = (StringCallback) p.cb;
                        CreateResponse rsp = (CreateResponse) p.response;
                        if (rc == 0) {
                            cb.processResult(
                                    rc,
                                    clientPath,
                                    p.ctx,
                                    (chrootPath == null ? rsp.getPath() : rsp
                                            .getPath().substring(
                                                    chrootPath.length())));
                        } else {
                            cb.processResult(rc, clientPath, p.ctx, null);
                        }
                    } else if (p.cb instanceof VoidCallback) {
                        VoidCallback cb = (VoidCallback) p.cb;
                        cb.processResult(rc, clientPath, p.ctx);
                    }
                }
            } catch (Throwable t) {
                LOG.error("Caught unexpected throwable", t);
            }
View Full Code Here

Examples of org.voltcore.zk.ZKUtil.ChildrenCallback

        HashSet<Integer> existingPartitions = new HashSet<Integer>(initiatorLeaders.keySet());
        List<String> partitions = zk.getChildren(VoltZK.leaders_initiators, partitionWatcher);
        Map<Integer, ChildrenCallback> callbacks = new HashMap<Integer, ChildrenCallback>();
        for (String partitionString : partitions) {
            int partition = LeaderElector.getPartitionFromElectionDir(partitionString);
            ChildrenCallback cb = new ChildrenCallback();

            if (!existingPartitions.contains(partition)) {
                String path = ZKUtil.joinZKPath(VoltZK.leaders_initiators, partitionString);
                zk.getChildren(path, new LeaderWatcher(partition, path), cb, null);
                callbacks.put(partition, cb);
View Full Code Here

Examples of org.voltcore.zk.ZKUtil.ChildrenCallback

        }
    }

    private void watchInitiatorLeader(int partition, String path)
    throws KeeperException, InterruptedException {
        ChildrenCallback cb = new ChildrenCallback();
        zk.getChildren(path, new LeaderWatcher(partition, path), cb, null);
        processInitiatorLeader(partition, cb);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.