gpt4 book ai didi

org.apache.fluo.accumulo.util.ZookeeperUtil类的使用及代码示例

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

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

ZookeeperUtil介绍

[英]Helper methods for Zookeeper
[中]Zookeeper的助手方法

代码示例

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

private void waitForGcTime(long expectedTime) throws Exception {
 env.getSharedResources().getTimestampTracker().updateZkNode();
 long oldestTs = ZookeeperUtil.getGcTimestamp(config.getAppZookeepers());
 while (oldestTs < expectedTime) {
  Thread.sleep(500);
  oldestTs = ZookeeperUtil.getGcTimestamp(config.getAppZookeepers());
 }
}

代码示例来源:origin: org.apache.fluo/fluo-core

public static boolean isInitialized(FluoConfiguration config) {
 try (CuratorFramework rootCurator = CuratorUtil.newRootFluoCurator(config)) {
  rootCurator.start();
  String appRootDir = ZookeeperUtil.parseRoot(config.getAppZookeepers());
  return rootCurator.checkExists().forPath(appRootDir) != null;
 } catch (Exception e) {
  throw new IllegalStateException(e);
 }
}

代码示例来源:origin: org.apache.fluo/fluo-core

/**
 * Creates a curator built using Fluo's zookeeper connection string. Root path will start at root
 * "/" of Zookeeper.
 */
public static CuratorFramework newRootFluoCurator(FluoConfiguration config) {
 return newCurator(ZookeeperUtil.parseServers(config.getInstanceZookeepers()),
   config.getZookeeperTimeout(), config.getZookeeperSecret());
}

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

/**
 * Creates a curator built using Fluo's zookeeper connection string. Root path will start at root
 * "/" of Zookeeper.
 */
public static CuratorFramework newRootFluoCurator(FluoConfiguration config) {
 return newCurator(ZookeeperUtil.parseServers(config.getInstanceZookeepers()),
   config.getZookeeperTimeout(), config.getZookeeperSecret());
}

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

public static boolean isInitialized(FluoConfiguration config) {
 try (CuratorFramework rootCurator = CuratorUtil.newRootFluoCurator(config)) {
  rootCurator.start();
  String appRootDir = ZookeeperUtil.parseRoot(config.getAppZookeepers());
  return rootCurator.checkExists().forPath(appRootDir) != null;
 } catch (Exception e) {
  throw new IllegalStateException(e);
 }
}

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

@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options,
  IteratorEnvironment env) throws IOException {
 if (env.getIteratorScope() == IteratorScope.scan) {
  throw new IllegalArgumentException();
 }
 this.source = source;
 isFullMajc = env.getIteratorScope() == IteratorScope.majc && env.isFullMajorCompaction();
 String oats = options.get(GC_TIMESTAMP_OPT);
 if (oats != null) {
  gcTimestamp = Long.valueOf(oats);
 } else {
  String zookeepers = options.get(ZOOKEEPER_CONNECT_OPT);
  if (zookeepers == null) {
   throw new IllegalArgumentException("A configuration item for GC iterator was not set");
  }
  gcTimestamp = ZookeeperUtil.getGcTimestamp(zookeepers);
 }
}

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

public FluoAdminImpl(FluoConfiguration config) {
 this.config = config;
 appRootDir = ZookeeperUtil.parseRoot(config.getAppZookeepers());
 rootCurator = CuratorUtil.newRootFluoCurator(config);
 rootCurator.start();
}

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

@Test
public void testGetOldestTimestamp() throws Exception {
 // we are expecting an error in this test
 final Level curLevel = Logger.getLogger(ZookeeperUtil.class).getLevel();
 Logger.getLogger(ZookeeperUtil.class).setLevel(Level.FATAL);
 // verify that oracle initial current ts
 Assert.assertEquals(0, ZookeeperUtil.getGcTimestamp(config.getAppZookeepers()));
 // delete the oracle current timestamp path
 env.getSharedResources().getCurator().delete().forPath(ZookeeperPath.ORACLE_GC_TIMESTAMP);
 // verify that oldest possible is returned
 Assert.assertEquals(ZookeeperUtil.OLDEST_POSSIBLE,
   ZookeeperUtil.getGcTimestamp(config.getAppZookeepers()));
 // set level back
 Logger.getLogger(ZookeeperUtil.class).setLevel(curLevel);
}

代码示例来源:origin: org.apache.fluo/fluo-core

public FluoAdminImpl(FluoConfiguration config) {
 this.config = config;
 appRootDir = ZookeeperUtil.parseRoot(config.getAppZookeepers());
 rootCurator = CuratorUtil.newRootFluoCurator(config);
 rootCurator.start();
}

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

long oldestTS = ZookeeperUtil.getGcTimestamp(config.getAppZookeepers());
 oldestTS = ZookeeperUtil.getGcTimestamp(config.getAppZookeepers());

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

@Test
public void testInitializeLongChroot() throws Exception {
 // stop oracle to avoid spurious exceptions when initializing
 oserver.stop();
 String zk = config.getAppZookeepers();
 String longPath = "/very/long/path";
 config.setInstanceZookeepers(zk + longPath);
 InitializationOptions opts = new InitializationOptions();
 opts.setClearZookeeper(true).setClearTable(true);
 try (FluoAdmin admin = new FluoAdminImpl(config)) {
  admin.initialize(opts);
 }
 try (CuratorFramework curator = CuratorUtil.newRootFluoCurator(config)) {
  curator.start();
  Assert.assertNotNull(curator.checkExists().forPath(ZookeeperUtil.parseRoot(zk + longPath)));
 }
 String longPath2 = "/very/long/path2";
 config.setInstanceZookeepers(zk + longPath2);
 try (FluoAdmin admin = new FluoAdminImpl(config)) {
  admin.initialize(opts);
 }
 try (CuratorFramework curator = CuratorUtil.newRootFluoCurator(config)) {
  curator.start();
  Assert.assertNotNull(curator.checkExists().forPath(ZookeeperUtil.parseRoot(zk + longPath2)));
  Assert.assertNotNull(curator.checkExists().forPath(ZookeeperUtil.parseRoot(zk + longPath)));
 }
}

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

LongUtil.toByteArray(nextTs));
long gcTs = ZookeeperUtil.getGcTimestamp(config.getAppZookeepers());
while (gcTs < nextTs) {
 Thread.sleep(500);
 gcTs = ZookeeperUtil.getGcTimestamp(config.getAppZookeepers());

代码示例来源:origin: org.apache.fluo/fluo-core

!ZookeeperUtil.parseRoot(config.getInstanceZookeepers()).equals("/"),
"The Zookeeper connection string (set by 'fluo.connection.zookeepers') "
  + " must have a chroot suffix.");

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

public void testVerifyAfterGC() throws Exception {
 final TestTransaction tx1 = new TestTransaction(env);
 BankUtil.setBalance(tx1, "bob", 10);
 BankUtil.setBalance(tx1, "joe", 20);
 BankUtil.setBalance(tx1, "jill", 60);
 tx1.done();
 BankUtil.transfer(env, "joe", "jill", 1);
 BankUtil.transfer(env, "joe", "bob", 1);
 BankUtil.transfer(env, "bob", "joe", 2);
 BankUtil.transfer(env, "jill", "joe", 2);
 final TestTransaction tx2 = new TestTransaction(env);
 waitForGcTime(tx2.getStartTimestamp());
 long oldestTs = ZookeeperUtil.getGcTimestamp(config.getAppZookeepers());
 Assert.assertEquals(tx2.getStartTs(), oldestTs);
 // Force a garbage collection
 aClient.tableOperations().flush(table, null, null, true);
 verify(oldestTs);
 final TestTransaction tx3 = new TestTransaction(env);
 Assert.assertEquals(9, BankUtil.getBalance(tx3, "bob"));
 Assert.assertEquals(22, BankUtil.getBalance(tx3, "joe"));
 Assert.assertEquals(59, BankUtil.getBalance(tx3, "jill"));
 tx3.done();
 tx2.done();
}

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

!ZookeeperUtil.parseRoot(config.getInstanceZookeepers()).equals("/"),
"The Zookeeper connection string (set by 'fluo.connection.zookeepers') "
  + " must have a chroot suffix.");

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

!ZookeeperUtil.parseRoot(config.getInstanceZookeepers()).equals("/"),
"The Zookeeper connection string (set by 'fluo.connection.zookeepers') "
  + " must have a chroot suffix.");

代码示例来源:origin: org.apache.fluo/fluo-core

!ZookeeperUtil.parseRoot(config.getInstanceZookeepers()).equals("/"),
"The Zookeeper connection string (set by 'fluo.connection.zookeepers') "
  + " must have a chroot suffix.");

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