gpt4 book ai didi

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

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

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

ZooReaderWriter.getInstance介绍

暂无

代码示例

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

public DeadServerList(String path) {
 this.path = path;
 IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 try {
  zoo.mkdirs(path);
 } catch (Exception ex) {
  log.error("Unable to make parent directories of " + path, ex);
 }
}

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

public void post(String server, String cause) {
  IZooReaderWriter zoo = ZooReaderWriter.getInstance();
  try {
   zoo.putPersistentData(path + "/" + server, cause.getBytes(UTF_8), NodeExistsPolicy.SKIP);
  } catch (Exception ex) {
   log.error(ex, ex);
  }
 }
}

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

private void deleteServerNode(String serverNode) throws InterruptedException, KeeperException {
 try {
  ZooReaderWriter.getInstance().delete(serverNode, -1);
 } catch (NotEmptyException ex) {
  // race condition: tserver created the lock after our last check; we'll see it at the next
  // check
 } catch (NoNodeException nne) {
  // someone else deleted it
 }
}

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

public void delete(String server) {
 IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 try {
  zoo.recursiveDelete(path + "/" + server, NodeMissingPolicy.SKIP);
 } catch (Exception ex) {
  log.error("delete failed with exception", ex);
 }
}

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

public DeadServerList(String path) {
 this.path = path;
 IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 try {
  zoo.mkdirs(path);
 } catch (Exception ex) {
  log.error("Unable to make parent directories of " + path, ex);
 }
}

代码示例来源: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-tracer

private void registerInZooKeeper(String name, String root) throws Exception {
 IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 zoo.putPersistentData(root, new byte[0], NodeExistsPolicy.SKIP);
 log.info("Registering tracer " + name + " at " + root);
 String path = zoo.putEphemeralSequential(root + "/trace-", name.getBytes(UTF_8));
 zoo.exists(path, this);
}

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

public static void prepareNewNamespaceState(String instanceId, String namespaceId,
  String namespace, NodeExistsPolicy existsPolicy)
  throws KeeperException, InterruptedException {
 log.debug(
   "Creating ZooKeeper entries for new namespace " + namespace + " (ID: " + namespaceId + ")");
 String zPath = Constants.ZROOT + "/" + instanceId + Constants.ZNAMESPACES + "/" + namespaceId;
 IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 zoo.putPersistentData(zPath, new byte[0], existsPolicy);
 zoo.putPersistentData(zPath + Constants.ZNAMESPACE_NAME, namespace.getBytes(UTF_8),
   existsPolicy);
 zoo.putPersistentData(zPath + Constants.ZNAMESPACE_CONF, new byte[0], existsPolicy);
}

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

@Override
public void run() {
 try {
  // Initially set the logger if the Monitor's log4j advertisement node exists
  if (ZooReaderWriter.getInstance().exists(path, this))
   updateMonitorLog4jLocation();
  log.info("Set watch for Monitor Log4j watcher");
 } catch (Exception e) {
  log.error("Unable to set watch for Monitor Log4j watcher on " + path);
 }
 super.run();
}

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

private void createUserNodeInZk(String principal) throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  IZooReaderWriter zoo = ZooReaderWriter.getInstance();
  zoo.putPrivatePersistentData(zkUserPath + "/" + principal, new byte[0],
    NodeExistsPolicy.FAIL);
 }
}

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

/**
 * Sets up the user in ZK for the provided user. No checking for existence is done here, it should
 * be done before calling.
 */
private void constructUser(String user, byte[] pass)
  throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  IZooReaderWriter zoo = ZooReaderWriter.getInstance();
  zoo.putPrivatePersistentData(ZKUserPath + "/" + user, pass, NodeExistsPolicy.FAIL);
 }
}

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

public void clearMergeState(Text tableId) throws IOException, KeeperException, InterruptedException {
 synchronized (mergeLock) {
  String path = ZooUtil.getRoot(instance.getInstanceID()) + Constants.ZTABLES + "/" + tableId.toString() + "/merge";
  ZooReaderWriter.getInstance().recursiveDelete(path, NodeMissingPolicy.SKIP);
  mergeLock.notifyAll();
 }
 nextEvent.event("Merge state of %s cleared", tableId);
}

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

@Override
public void put(String path, byte[] bs) throws DistributedStoreException {
 try {
  path = relative(path);
  ZooReaderWriter.getInstance().putPersistentData(path, bs, NodeExistsPolicy.OVERWRITE);
  cache.clear();
  log.debug("Wrote " + new String(bs, UTF_8) + " to " + path);
 } catch (Exception ex) {
  throw new DistributedStoreException(ex);
 }
}

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

public static void stop(String type, long tid) throws KeeperException, InterruptedException {
 Instance instance = HdfsZooInstance.getInstance();
 IZooReaderWriter writer = ZooReaderWriter.getInstance();
 writer.recursiveDelete(ZooUtil.getRoot(instance) + "/" + type + "/" + tid,
   NodeMissingPolicy.SKIP);
}

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

public static void removeSystemProperty(String property) throws InterruptedException, KeeperException {
  String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZCONFIG + "/" + property;
  ZooReaderWriter.getInstance().recursiveDelete(zPath, NodeMissingPolicy.FAIL);
 }
}

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

MasterGoalState getMasterGoalState() {
 while (true)
  try {
   byte[] data = ZooReaderWriter.getInstance()
     .getData(ZooUtil.getRoot(getInstance()) + Constants.ZMASTER_GOAL_STATE, null);
   return MasterGoalState.valueOf(new String(data));
  } catch (Exception e) {
   log.error("Problem getting real goal state from zookeeper: " + e);
   sleepUninterruptibly(1, TimeUnit.SECONDS);
  }
}

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

@Override
public void process(WatchedEvent event) {
 // We got an update, process the data in the node
 updateMonitorLog4jLocation();
 if (event.getPath() != null) {
  try {
   ZooReaderWriter.getInstance().exists(event.getPath(), this);
  } catch (Exception ex) {
   log.error("Unable to reset watch for Monitor Log4j watcher", ex);
  }
 }
}

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

public void clearMergeState(String tableId)
  throws IOException, KeeperException, InterruptedException {
 synchronized (mergeLock) {
  String path = ZooUtil.getRoot(getInstance().getInstanceID()) + Constants.ZTABLES + "/"
    + tableId + "/merge";
  ZooReaderWriter.getInstance().recursiveDelete(path, NodeMissingPolicy.SKIP);
  mergeLock.notifyAll();
 }
 nextEvent.event("Merge state of %s cleared", tableId);
}

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

public static void cleanup(String type, long tid) throws KeeperException, InterruptedException {
 Instance instance = HdfsZooInstance.getInstance();
 IZooReaderWriter writer = ZooReaderWriter.getInstance();
 writer.recursiveDelete(ZooUtil.getRoot(instance) + "/" + type + "/" + tid, NodeMissingPolicy.SKIP);
 writer.recursiveDelete(ZooUtil.getRoot(instance) + "/" + type + "/" + tid + "-running", NodeMissingPolicy.SKIP);
}

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

public static void start(String type, long tid) throws KeeperException, InterruptedException {
 Instance instance = HdfsZooInstance.getInstance();
 IZooReaderWriter writer = ZooReaderWriter.getInstance();
 writer.putPersistentData(ZooUtil.getRoot(instance) + "/" + type, new byte[] {}, NodeExistsPolicy.OVERWRITE);
 writer.putPersistentData(ZooUtil.getRoot(instance) + "/" + type + "/" + tid, new byte[] {}, NodeExistsPolicy.OVERWRITE);
 writer.putPersistentData(ZooUtil.getRoot(instance) + "/" + type + "/" + tid + "-running", new byte[] {}, NodeExistsPolicy.OVERWRITE);
}

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