gpt4 book ai didi

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

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

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

ZooLock.getLockData介绍

暂无

代码示例

代码示例来源:origin: apache/accumulo

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: apache/accumulo

@SuppressFBWarnings(value = "DM_EXIT",
   justification = "TODO - should probably avoid System.exit here; "
     + "this code is used by the fate admin shell command")
 public boolean checkGlobalLock(IZooReaderWriter zk, String path) {
  try {
   if (ZooLock.getLockData(zk.getZooKeeper(), path) != null) {
    System.err.println("ERROR: Master lock is held, not running");
    if (this.exitOnError)
     System.exit(1);
    else
     return false;
   }
  } catch (KeeperException e) {
   System.err.println("ERROR: Could not read master lock, not running " + e.getMessage());
   if (this.exitOnError)
    System.exit(1);
   else
    return false;
  } catch (InterruptedException e) {
   System.err.println("ERROR: Could not read master lock, not running" + e.getMessage());
   if (this.exitOnError)
    System.exit(1);
   else
    return false;
  }
  return true;
 }
}

代码示例来源:origin: apache/accumulo

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

代码示例来源:origin: apache/accumulo

public static void main(String[] args) throws Exception {
 try (ServerContext context = new ServerContext(new SiteConfiguration())) {
  String tserverPath = context.getZooKeeperRoot() + Constants.ZTSERVERS;
  Opts opts = new Opts();
  opts.parseArgs(TabletServerLocks.class.getName(), args);
  ZooCache cache = context.getZooCache();
  ZooReaderWriter zoo = context.getZooReaderWriter();
  if (opts.list) {
   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(zoo, tserverPath + "/" + args[1]);
  } else {
   System.out.println(
     "Usage : " + TabletServerLocks.class.getName() + " -list|-delete <tserver lock>");
  }
 }
}

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

public boolean checkGlobalLock(IZooReaderWriter zk, String path) {
  try {
   if (ZooLock.getLockData(zk.getZooKeeper(), path) != null) {
    System.err.println("ERROR: Master lock is held, not running");
    if (this.exitOnError)
     System.exit(1);
    else
     return false;
   }
  } catch (KeeperException e) {
   System.err.println("ERROR: Could not read master lock, not running " + e.getMessage());
   if (this.exitOnError)
    System.exit(1);
   else
    return false;
  } catch (InterruptedException e) {
   System.err.println("ERROR: Could not read master lock, not running" + e.getMessage());
   if (this.exitOnError)
    System.exit(1);
   else
    return false;
  }
  return true;
 }
}

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

private void waitForGCLock(Connector conn) throws InterruptedException {
 // Check if the GC process has the lock before wasting our retry attempts
 ZooKeeperInstance zki = (ZooKeeperInstance) conn.getInstance();
 ZooCacheFactory zcf = new ZooCacheFactory();
 ZooCache zcache = zcf.getZooCache(zki.getZooKeepers(), zki.getZooKeepersSessionTimeOut());
 String zkPath = ZooUtil.getRoot(conn.getInstance()) + Constants.ZGC_LOCK;
 log.info("Looking for GC lock at {}", zkPath);
 byte[] data = ZooLock.getLockData(zcache, zkPath, null);
 while (null == data) {
  log.info("Waiting for GC ZooKeeper lock to be acquired");
  Thread.sleep(1000);
  data = ZooLock.getLockData(zcache, zkPath, null);
 }
}

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

byte[] gcLockData;
do {
 gcLockData = ZooLock.getLockData(zcache, path, null);
 if (null != gcLockData) {
  log.info("Waiting for GC ZooKeeper lock to expire");
 gcLockData = ZooLock.getLockData(zcache, path, null);
 if (null == gcLockData) {
  log.info("Waiting for GC ZooKeeper lock to be acquired");

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

byte[] masterLockData;
do {
 masterLockData = ZooLock.getLockData(zcache,
   ZooUtil.getRoot(connector.getInstance()) + Constants.ZMASTER_LOCK, null);
 if (null != masterLockData) {

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

byte[] masterLockData;
do {
 masterLockData = ZooLock.getLockData(zcache,
   ZooUtil.getRoot(c.getInstance()) + Constants.ZMASTER_LOCK, null);
 if (null != masterLockData) {

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

byte[] masterLockData;
do {
 masterLockData = ZooLock.getLockData(zcache,
   ZooUtil.getRoot(c.getInstance()) + Constants.ZMASTER_LOCK, null);
 if (null != masterLockData) {
 masterLockData = ZooLock.getLockData(zcache,
   ZooUtil.getRoot(c.getInstance()) + Constants.ZMASTER_LOCK, null);
 if (null != masterLockData) {

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