gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-14 05:57:31 25 4
gpt4 key购买 nike

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

ZooLock.getLockData介绍

暂无

代码示例

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

private static String getMaster(ZooCache cache, UUID iid, boolean printErrors) {
 if (iid == null) {
  return null;
 }
 try {
  String masterLocPath = Constants.ZROOT + "/" + iid + Constants.ZMASTER_LOCK;
  byte[] master = ZooLock.getLockData(cache, masterLocPath, null);
  if (master == null) {
   return null;
  }
  return new String(master, UTF_8);
 } catch (Exception e) {
  handleException(e, printErrors);
  return null;
 }
}

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

private static String getMaster(ZooCache cache, UUID iid) {
 if (iid == null) {
  return null;
 }
 try {
  String masterLocPath = Constants.ZROOT + "/" + iid + Constants.ZMASTER_LOCK;
  byte[] master = ZooLock.getLockData(cache, masterLocPath, null);
  if (master == null) {
   return null;
  }
  return new String(master, UTF_8);
 } catch (Exception e) {
  handleException(e);
  return null;
 }
}

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

@Override
public List<String> getMasterLocations() {
 String masterLocPath = ZooUtil.getRoot(this) + Constants.ZMASTER_LOCK;
 OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up master location in zoocache.");
 byte[] loc = ZooLock.getLockData(zooCache, masterLocPath, null);
 opTimer.stop("Found master at " + (loc == null ? null : new String(loc, UTF_8)) + " in %DURATION%");
 if (loc == null) {
  return Collections.emptyList();
 }
 return Collections.singletonList(new String(loc, UTF_8));
}

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

@Override
public List<String> getMasterLocations() {
 String masterLocPath = ZooUtil.getRoot(this) + Constants.ZMASTER_LOCK;
 OpTimer timer = null;
 if (log.isTraceEnabled()) {
  log.trace("tid={} Looking up master location in zoocache.", Thread.currentThread().getId());
  timer = new OpTimer().start();
 }
 byte[] loc = ZooLock.getLockData(zooCache, masterLocPath, null);
 if (timer != null) {
  timer.stop();
  log.trace("tid={} Found master at {} in {}", Thread.currentThread().getId(),
    (loc == null ? "null" : new String(loc, UTF_8)),
    String.format("%.3f secs", timer.scale(TimeUnit.SECONDS)));
 }
 if (loc == null) {
  return Collections.emptyList();
 }
 return Collections.singletonList(new String(loc, UTF_8));
}

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

byte[] lockData = ZooLock.getLockData(getZooCache(), lockPath, stat);

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

byte[] lockData = ZooLock.getLockData(getZooCache(), lockPath, stat);

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

public static void main(String[] args) throws Exception {
 Instance instance = HdfsZooInstance.getInstance();
 String tserverPath = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
 Opts opts = new Opts();
 opts.parseArgs(TabletServerLocks.class.getName(), args);
 ZooCache cache = new ZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
 if (opts.list) {
  IZooReaderWriter zoo = ZooReaderWriter.getInstance();
  List<String> tabletServers = zoo.getChildren(tserverPath);
  for (String tabletServer : tabletServers) {
   byte[] lockData = ZooLock.getLockData(cache, tserverPath + "/" + tabletServer, null);
   String holder = null;
   if (lockData != null) {
    holder = new String(lockData, UTF_8);
   }
   System.out.printf("%32s %16s%n", tabletServer, holder);
  }
 } else if (opts.delete != null) {
  ZooLock.deleteLock(tserverPath + "/" + args[1]);
 } else {
  System.out.println(
    "Usage : " + TabletServerLocks.class.getName() + " -list|-delete <tserver lock>");
 }
}

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

public static void main(String[] args) throws Exception {
 Instance instance = HdfsZooInstance.getInstance();
 String tserverPath = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
 Opts opts = new Opts();
 opts.parseArgs(TabletServerLocks.class.getName(), args);
 ZooCache cache = new ZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
 if (opts.list) {
  IZooReaderWriter zoo = ZooReaderWriter.getInstance();
  List<String> tabletServers = zoo.getChildren(tserverPath);
  for (String tabletServer : tabletServers) {
   byte[] lockData = ZooLock.getLockData(cache, tserverPath + "/" + tabletServer, null);
   String holder = null;
   if (lockData != null) {
    holder = new String(lockData, UTF_8);
   }
   System.out.printf("%32s %16s%n", tabletServer, holder);
  }
 } else if (opts.delete != null) {
  ZooLock.deleteLock(tserverPath + "/" + args[1]);
 } else {
  System.out.println("Usage : " + TabletServerLocks.class.getName() + " -list|-delete <tserver lock>");
 }
}

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