gpt4 book ai didi

org.apache.accumulo.server.zookeeper.ZooReaderWriter.getChildren()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 21:58:03 28 4
gpt4 key购买 nike

本文整理了Java中org.apache.accumulo.server.zookeeper.ZooReaderWriter.getChildren()方法的一些代码示例,展示了ZooReaderWriter.getChildren()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooReaderWriter.getChildren()方法的具体详情如下:
包路径:org.apache.accumulo.server.zookeeper.ZooReaderWriter
类名称:ZooReaderWriter
方法名:getChildren

ZooReaderWriter.getChildren介绍

暂无

代码示例

代码示例来源:origin: org.apache.accumulo/accumulo-server

@Override
 public void run() {
  try {
   lookForWork(processor, zoo.getChildren(path));
  } catch (KeeperException e) {
   log.error("Failed to look for work", e);
  } catch (InterruptedException e) {
   log.info("Interrupted looking for work", e);
  }
 }
}, r.nextInt(60 * 1000), 60 * 1000);

代码示例来源:origin: org.apache.accumulo/accumulo-server

public List<String> getWorkQueued() throws KeeperException, InterruptedException {
 ArrayList<String> children = new ArrayList<String>(zoo.getChildren(path));
 children.remove(LOCKS_NODE);
 return children;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

public List<String> getWorkQueued() throws KeeperException, InterruptedException {
 ArrayList<String> children = new ArrayList<>(zoo.getChildren(path));
 children.remove(LOCKS_NODE);
 return children;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

@Override
 public void run() {
  log.debug("Looking for work in " + path);
  try {
   lookForWork(processor, zoo.getChildren(path));
  } catch (KeeperException e) {
   log.error("Failed to look for work", e);
  } catch (InterruptedException e) {
   log.info("Interrupted looking for work", e);
  }
 }
}, timerInitialDelay, timerPeriod);

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

List<String> children = zoo.getChildren(path, watcher);
  condVar.wait(10000);
 children = zoo.getChildren(path, watcher);

代码示例来源:origin: org.apache.accumulo/accumulo-server

List<String> children = zoo.getChildren(path, watcher);
  condVar.wait(10000);
 children = zoo.getChildren(path, watcher);

代码示例来源:origin: org.apache.accumulo/accumulo-master

@Override
 public void process(WatchedEvent event) {
  nextEvent.event("Noticed recovery changes", event.getType());
  try {
   // watcher only fires once, add it back
   ZooReaderWriter.getInstance().getChildren(zroot + Constants.ZRECOVERY, this);
  } catch (Exception e) {
   log.error("Failed to add log recovery watcher back", e);
  }
 }
});

代码示例来源:origin: org.apache.accumulo/accumulo-server

@Override
 public void process(WatchedEvent event) {
  nextEvent.event("Noticed recovery changes", event.getType());
  try {
   // watcher only fires once, add it back
   ZooReaderWriter.getInstance().getChildren(zroot + Constants.ZRECOVERY, this);
  } catch (Exception e) {
   log.error("Failed to add log recovery watcher back", e);
  }
 }
});

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

public Map<TServerInstance,List<UUID>> getAllMarkers() throws WalMarkerException {
 Map<TServerInstance,List<UUID>> result = new HashMap<>();
 try {
  String path = root();
  for (String child : zoo.getChildren(path)) {
   TServerInstance inst = new TServerInstance(child);
   List<UUID> logs = result.get(inst);
   if (logs == null) {
    result.put(inst, logs = new ArrayList<>());
   }
   for (String idString : zoo.getChildren(path + "/" + child)) {
    logs.add(UUID.fromString(idString));
   }
  }
 } catch (KeeperException | InterruptedException e) {
  throw new WalMarkerException(e);
 }
 return result;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

@Override
 public void process(WatchedEvent event) {
  switch (event.getType()) {
   case NodeChildrenChanged:
    if (event.getPath().equals(path))
     try {
      lookForWork(processor, zoo.getChildren(path, this));
     } catch (KeeperException e) {
      log.error("Failed to look for work", e);
     } catch (InterruptedException e) {
      log.info("Interrupted looking for work", e);
     }
    else
     log.info("Unexpected path for NodeChildrenChanged event " + event.getPath());
    break;
   case NodeCreated:
   case NodeDataChanged:
   case NodeDeleted:
   case None:
    log.info("Got unexpected zookeeper event: " + event.getType() + " for " + path);
    break;
  }
 }
});

代码示例来源:origin: org.apache.accumulo/accumulo-server

@Override
 public void process(WatchedEvent event) {
  switch (event.getType()) {
   case NodeChildrenChanged:
    if (event.getPath().equals(path))
     try {
      lookForWork(processor, zoo.getChildren(path, this));
     } catch (KeeperException e) {
      log.error("Failed to look for work", e);
     } catch (InterruptedException e) {
      log.info("Interrupted looking for work", e);
     }
    else
     log.info("Unexpected path for NodeChildrenChanged event " + event.getPath());
    break;
   case NodeCreated:
   case NodeDataChanged:
   case NodeDeleted:
   case None:
    log.info("Got unexpected zookeeper event: " + event.getType() + " for " + path);
    break;
  }
 }
});

代码示例来源:origin: org.apache.accumulo/accumulo-server

boolean holdsLock(InetSocketAddress addr) {
 try {
  String zpath = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + org.apache.accumulo.core.util.AddressUtil.toString(addr);
  List<String> children = ZooReaderWriter.getInstance().getChildren(zpath);
  return !(children == null || children.isEmpty());
 } catch (KeeperException.NoNodeException ex) {
  return false;
 } catch (Exception ex) {
  log.debug(ex, ex);
  return true;
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

/**
 * Fetch all {@link AuthenticationKey}s currently stored in ZooKeeper beneath the configured
 * {@code baseNode}.
 *
 * @return A list of {@link AuthenticationKey}s
 */
public List<AuthenticationKey> getCurrentKeys() throws KeeperException, InterruptedException {
 checkState(initialized.get(), "Not initialized");
 List<String> children = zk.getChildren(baseNode);
 // Shortcircuit to avoid a list creation
 if (children.isEmpty()) {
  return Collections.<AuthenticationKey> emptyList();
 }
 // Deserialize each byte[] into an AuthenticationKey
 List<AuthenticationKey> keys = new ArrayList<>(children.size());
 for (String child : children) {
  byte[] data = zk.getData(qualifyPath(child), null);
  if (null != data) {
   AuthenticationKey key = new AuthenticationKey();
   try {
    key.readFields(new DataInputStream(new ByteArrayInputStream(data)));
   } catch (IOException e) {
    throw new AssertionError("Error reading from in-memory buffer which should not happen",
      e);
   }
   keys.add(key);
  }
 }
 return keys;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

lookForWork(processor, zoo.getChildren(path));
} catch (KeeperException e) {
 log.error("Failed to look for work", e);

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

lookForWork(processor, zoo.getChildren(path));
} catch (KeeperException e) {
 log.error("Failed to look for work", e);

代码示例来源:origin: org.apache.accumulo/accumulo-test

List<String> locks;
try {
 locks = zk.getChildren(path, null);
} catch (NoNodeException e) {
 Thread.sleep(5000);

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

public List<Path> getWalsInUse(TServerInstance tsi) throws WalMarkerException {
 List<Path> result = new ArrayList<>();
 try {
  String zpath = root() + "/" + tsi.toString();
  zoo.sync(zpath);
  for (String child : zoo.getChildren(zpath)) {
   Pair<WalState,Path> parts = parse(zoo.getData(zpath + "/" + child, null));
   if (parts.getFirst() != WalState.UNREFERENCED) {
    result.add(parts.getSecond());
   }
  }
 } catch (KeeperException.NoNodeException e) {
  log.debug("{} has no wal entry in zookeeper, assuming no logs", tsi);
 } catch (KeeperException | InterruptedException e) {
  throw new WalMarkerException(e);
 }
 return result;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

private static GCStatus fetchGcStatus() {
 GCStatus result = null;
 InetSocketAddress address = null;
 try {
  // Read the gc location from its lock
  ZooReaderWriter zk = ZooReaderWriter.getInstance();
  String path = ZooUtil.getRoot(instance) + Constants.ZGC_LOCK;
  List<String> locks = zk.getChildren(path, null);
  if (locks != null && locks.size() > 0) {
   Collections.sort(locks);
   address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null), UTF_8)).getAddress(Service.GC_CLIENT);
   GCMonitorService.Client client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(), address, config.getConfiguration());
   try {
    result = client.getStatus(Tracer.traceInfo(), SecurityConstants.getSystemCredentials());
   } finally {
    ThriftUtil.returnClient(client);
   }
  }
 } catch (Exception ex) {
  log.warn("Unable to contact the garbage collector at " + address, ex);
 }
 return result;
}

代码示例来源:origin: org.apache.accumulo/accumulo-monitor

private static GCStatus fetchGcStatus() {
 GCStatus result = null;
 HostAndPort address = null;
 try {
  // Read the gc location from its lock
  ZooReaderWriter zk = ZooReaderWriter.getInstance();
  String path = ZooUtil.getRoot(instance) + Constants.ZGC_LOCK;
  List<String> locks = zk.getChildren(path, null);
  if (locks != null && locks.size() > 0) {
   Collections.sort(locks);
   address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null), UTF_8))
     .getAddress(Service.GC_CLIENT);
   GCMonitorService.Client client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(),
     address, new AccumuloServerContext(config));
   try {
    result = client.getStatus(Tracer.traceInfo(), getContext().rpcCreds());
   } finally {
    ThriftUtil.returnClient(client);
   }
  }
 } catch (Exception ex) {
  log.warn("Unable to contact the garbage collector at " + address, ex);
 }
 return result;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

zoo.mkdirs(path + "/" + LOCKS_NODE);
List<String> children = zoo.getChildren(path, new Watcher() {
 @Override
 public void process(WatchedEvent event) {

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com