本文整理了Java中org.apache.accumulo.server.zookeeper.ZooReaderWriterFactory
类的一些代码示例,展示了ZooReaderWriterFactory
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooReaderWriterFactory
类的具体详情如下:
包路径:org.apache.accumulo.server.zookeeper.ZooReaderWriterFactory
类名称:ZooReaderWriterFactory
[英]A factory for ZooReaderWriter objects.
[中]ZooReaderWriter对象的工厂。
代码示例来源: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-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-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-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
try {
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();
内容来源于网络,如有侵权,请联系作者删除!