gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-13 13:05:12 26 4
gpt4 key购买 nike

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

ZooReaderWriterFactory.getZooReaderWriter介绍

[英]Gets a new reader/writer.
[中]获取新的读写器。

代码示例

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

/**
  * Gets a reader/writer, retrieving ZooKeeper information from the site configuration. The same
  * instance may be returned for multiple calls.
  *
  * @return reader/writer
  */
 public IZooReaderWriter getInstance() {
  synchronized (ZooReaderWriterFactory.class) {
   if (instance == null) {
    AccumuloConfiguration conf = SiteConfiguration.getInstance();
    instance = getZooReaderWriter(conf.get(Property.INSTANCE_ZK_HOST),
      (int) conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT),
      conf.get(Property.INSTANCE_SECRET));
   }
   return instance;
  }
 }
}

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

IZooReaderWriter zrw = new ZooReaderWriterFactory().getZooReaderWriter(
  cc.get(Property.INSTANCE_ZK_HOST), (int) cc.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT),
  cc.get(Property.INSTANCE_SECRET));

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

private static FateStatus getFateStatus(Instance instance, AccumuloCluster cluster) {
  try {
   AdminUtil<String> admin = new AdminUtil<>(false);
   String secret = cluster.getSiteConfiguration().get(Property.INSTANCE_SECRET);
   IZooReaderWriter zk = new ZooReaderWriterFactory().getZooReaderWriter(
     instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), secret);
   ZooStore<String> zs = new ZooStore<>(ZooUtil.getRoot(instance) + Constants.ZFATE, zk);
   FateStatus fateStatus = admin.getStatus(zs, zk,
     ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, null, null);
   return fateStatus;
  } catch (KeeperException | InterruptedException e) {
   throw new RuntimeException(e);
  }
 }
}

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

/**
 * Checks fates in zookeeper looking for transaction associated with a compaction as a double
 * check that the test will be valid because the running compaction does have a fate transaction
 * lock.
 *
 * @return true if corresponding fate transaction found, false otherwise
 */
private boolean findFate(final String tableName) {
 Instance instance = connector.getInstance();
 AdminUtil<String> admin = new AdminUtil<>(false);
 try {
  String tableId = Tables.getTableId(instance, tableName);
  log.trace("tid: {}", tableId);
  String secret = cluster.getSiteConfiguration().get(Property.INSTANCE_SECRET);
  IZooReaderWriter zk = new ZooReaderWriterFactory().getZooReaderWriter(
    instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), secret);
  ZooStore<String> zs = new ZooStore<>(ZooUtil.getRoot(instance) + Constants.ZFATE, zk);
  AdminUtil.FateStatus fateStatus = admin.getStatus(zs, zk,
    ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS + "/" + tableId, null, null);
  for (AdminUtil.TransactionStatus tx : fateStatus.getTransactions()) {
   if (tx.getTop().contains("CompactionDriver") && tx.getDebug().contains("CompactRange")) {
    return true;
   }
  }
 } catch (KeeperException | TableNotFoundException | InterruptedException ex) {
  throw new IllegalStateException(ex);
 }
 // did not find appropriate fate transaction for compaction.
 return Boolean.FALSE;
}

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

String secret = getCluster().getSiteConfiguration().get(Property.INSTANCE_SECRET);
IZooReaderWriter writer = new ZooReaderWriterFactory()
  .getZooReaderWriter(cluster.getZooKeepers(), 30 * 1000, secret);
String root = "/accumulo/" + getConnector().getInstance().getInstanceID();
List<String> children = Collections.emptyList();

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

final long zkTimeout = AccumuloConfiguration.getTimeInMillis(
  getCluster().getConfig().getSiteConfig().get(Property.INSTANCE_ZK_TIMEOUT.getKey()));
IZooReaderWriter zrw = new ZooReaderWriterFactory().getZooReaderWriter(
  getCluster().getZooKeepers(), (int) zkTimeout, defaultConfig.get(Property.INSTANCE_SECRET));
final String zInstanceRoot = Constants.ZROOT + "/" + conn.getInstance().getInstanceID();

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