gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 16:17:31 27 4
gpt4 key购买 nike

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

ZooUtil.getZooKeeper介绍

暂无

代码示例

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

protected static ZooKeeper getZooKeeper(ZooKeeperConnectionInfo info) {
 return getZooKeeper(info.keepers, info.timeout, info.scheme, info.auth);
}

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

public static boolean isLockHeld(ZooKeeperConnectionInfo info, LockID lid)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   List<String> children = getZooKeeper(info).getChildren(lid.path, false);
   if (children.size() == 0) {
    return false;
   }
   Collections.sort(children);
   String lockNode = children.get(0);
   if (!lid.node.equals(lockNode))
    return false;
   Stat stat = getZooKeeper(info).exists(lid.path + "/" + lid.node, false);
   return stat != null && stat.getEphemeralOwner() == lid.eid;
  } catch (KeeperException ex) {
   final Code c = ex.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, ex);
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static Stat getStatus(ZooKeeperConnectionInfo info, String zPath)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).exists(zPath, false);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static byte[] getData(ZooKeeperConnectionInfo info, String zPath, Stat stat)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).getData(zPath, false, stat);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putEphemeralData(ZooKeeperConnectionInfo info, String zPath, byte[] data)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC, CreateMode.EPHEMERAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putPersistentSequential(ZooKeeperConnectionInfo info, String zPath,
  byte[] data) throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC,
     CreateMode.PERSISTENT_SEQUENTIAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putEphemeralSequential(ZooKeeperConnectionInfo info, String zPath,
  byte[] data) throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC,
     CreateMode.EPHEMERAL_SEQUENTIAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

while (true) {
 try {
  getZooKeeper(info).create(zPath, data, acls, mode);
  return true;
 } catch (KeeperException e) {
      getZooKeeper(info).setData(zPath, data, version);
      return true;
     } catch (KeeperException e2) {

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

public static List<ACL> getACL(ZooKeeperConnectionInfo info, String zPath, Stat stat)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).getACL(zPath, stat);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

while (true) {
 try {
  children = getZooKeeper(info).getChildren(zPath, false);
  break;
 } catch (KeeperException e) {
while (true) {
 try {
  stat = getZooKeeper(info).exists(zPath, null);
    getZooKeeper(info).delete(zPath, -1);
    return;
   } catch (NoNodeException e) {

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

protected static ZooKeeper getZooKeeper(ZooKeeperConnectionInfo info) {
 return getZooKeeper(info.keepers, info.timeout, info.scheme, info.auth);
}

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

while (true) {
 try {
  children = getZooKeeper(info).getChildren(source, false);
  break;
 } catch (KeeperException e) {

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

public static boolean isLockHeld(ZooKeeperConnectionInfo info, LockID lid)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   List<String> children = getZooKeeper(info).getChildren(lid.path, false);
   if (children.size() == 0) {
    return false;
   }
   Collections.sort(children);
   String lockNode = children.get(0);
   if (!lid.node.equals(lockNode))
    return false;
   Stat stat = getZooKeeper(info).exists(lid.path + "/" + lid.node, false);
   return stat != null && stat.getEphemeralOwner() == lid.eid;
  } catch (KeeperException ex) {
   final Code c = ex.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, ex);
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static byte[] getData(ZooKeeperConnectionInfo info, String zPath, Stat stat)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).getData(zPath, false, stat);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putEphemeralData(ZooKeeperConnectionInfo info, String zPath, byte[] data)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC, CreateMode.EPHEMERAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static Stat getStatus(ZooKeeperConnectionInfo info, String zPath)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).exists(zPath, false);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putPersistentSequential(ZooKeeperConnectionInfo info, String zPath,
  byte[] data) throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC,
     CreateMode.PERSISTENT_SEQUENTIAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putEphemeralSequential(ZooKeeperConnectionInfo info, String zPath,
  byte[] data) throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC,
     CreateMode.EPHEMERAL_SEQUENTIAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static List<ACL> getACL(ZooKeeperConnectionInfo info, String zPath, Stat stat)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).getACL(zPath, stat);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

while (true) {
 try {
  children = getZooKeeper(info).getChildren(source, false);
  break;
 } catch (KeeperException e) {

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