org.apache.zookeeper.server.ZKDatabase.getData()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(151)

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

ZKDatabase.getData介绍

[英]get data and stat for a path
[中]获取数据并统计路径

代码示例

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

private byte[] getKey(ZooKeeperServer zks) {
  ZKDatabase db = zks.getZKDatabase();
  if (db != null) {
    try {
      Stat stat = new Stat();
      return db.getData("/key", stat, null);
    } catch (NoNodeException e) {
      LOG.error("getData failed", e);
    }
  }
  return null;
}

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

new CreateTxn(path, "fpjwasalsohere".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, false, 1));
Stat stat = new Stat();
Assert.assertEquals("fpjwasalsohere", new String(zkDb.getData(path, stat, null)));

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

request.authInfo, path, null);
Stat stat = new Stat();
byte b[] = zks.getZKDatabase().getData(path, stat,
    getDataRequest.getWatch() ? cnxn : null);
rsp = new GetDataResponse(b, stat);

代码示例来源:origin: org.apache.zookeeper/zookeeper

request.authInfo);
Stat stat = new Stat();
byte b[] = zks.getZKDatabase().getData(getDataRequest.getPath(), stat,
    getDataRequest.getWatch() ? cnxn : null);
rsp = new GetDataResponse(b, stat);

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

Stat stat = new Stat();
  Assert.assertEquals("data1",
      new String(zkDb.getData("/foo1", stat, null)));
  Assert.assertEquals("data1",
      new String(zkDb.getData("/foo2", stat, null)));
  long lastZxid = zkDb2.loadDataBase();
  Assert.assertEquals("data1",
      new String(zkDb2.getData("/foo1", stat, null)));
  Assert.assertEquals(foo2Zxid, lastZxid);
      .getZKDatabase().getData("/foo2", stat, watcher)));
      .getZKDatabase().getData("/foo1", stat, null)));
  Assert.assertEquals("data2", new String(o.zk
      .getZKDatabase().getData("/foo2", stat, null)));
  Assert.assertEquals("data2", new String(zkDb2.getData("/foo1", stat, null)));
  Assert.assertEquals("data2", new String(zkDb2.getData("/foo2", stat, null)));
  Assert.assertEquals(informZxid, lastZxid);
} finally {

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

byte[] data = db.getData("/node-" + i, stat, null);
Assert.assertArrayEquals("Missmatch data", bytes, data);
Assert.assertTrue("Unknown zxid ", zxids.contains(stat.getMzxid()));

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

zkDb.processTxn(new TxnHeader(13, 1313, firstZxid, 33, ZooDefs.OpCode.create), new CreateTxn("/foo", "data1".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, false, 1));
Stat stat = new Stat();
Assert.assertEquals("data1", new String(zkDb.getData("/foo", stat, null)));

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

@Override
public byte[] getData(String path, Stat stat, Watcher watcher) throws KeeperException.NoNodeException {
 limiter.dataLimit.updateForWatch(path, watcher);
 return super.getData(path, stat, watcher);
}

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

zkDb.processTxn(new TxnHeader(13, 1313, firstZxid, 33, ZooDefs.OpCode.create), new CreateTxn("/foo", "data1".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, false, 1));
  Stat stat = new Stat();
  Assert.assertEquals("data1", new String(zkDb.getData("/foo", stat, null)));
  Assert.assertEquals("data1", new String(zkDb2.getData("/foo", stat, null)));
  Assert.assertEquals(firstZxid, lastZxid);
  Assert.assertEquals("data1", new String(f.fzk.getZKDatabase().getData("/foo", stat, watcher)));
  Assert.assertEquals("data2", new String(f.fzk.getZKDatabase().getData("/foo", stat, null)));
  Assert.assertEquals("data2", new String(zkDb2.getData("/foo", stat, null)));
  Assert.assertEquals(proposalZxid, lastZxid);
} finally {

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * Expire the ZK session of the given service. This requires
 * (and asserts) that the given service be the current active.
 * @throws NoNodeException if no service holds the lock
 */
public void expireActiveLockHolder(int idx)
  throws NoNodeException {
 Stat stat = new Stat();
 byte[] data = zks.getZKDatabase().getData(
   DummyZKFC.LOCK_ZNODE, stat, null);
 
 assertArrayEquals(Ints.toByteArray(svcs[idx].index), data);
 long session = stat.getEphemeralOwner();
 LOG.info("Expiring svc " + idx + "'s zookeeper session " + session);
 zks.closeSession(session);
}

代码示例来源:origin: org.apache.hadoop/zookeeper

request.authInfo);
Stat stat = new Stat();
byte b[] = zks.getZKDatabase().getData(getDataRequest.getPath(), stat,
    getDataRequest.getWatch() ? cnxn : null);
rsp = new GetDataResponse(b, stat);

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
 * Expire the ZK session of the given service. This requires
 * (and asserts) that the given service be the current active.
 * @throws NoNodeException if no service holds the lock
 */
public void expireActiveLockHolder(int idx)
  throws NoNodeException {
 Stat stat = new Stat();
 byte[] data = zks.getZKDatabase().getData(
   DummyZKFC.LOCK_ZNODE, stat, null);
 
 assertArrayEquals(Ints.toByteArray(svcs[idx].index), data);
 long session = stat.getEphemeralOwner();
 LOG.info("Expiring svc " + idx + "'s zookeeper session " + session);
 zks.closeSession(session);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

byte[] data = zks.getZKDatabase().getData(
 parentDir + "/" +
 ActiveStandbyElector.LOCK_FILENAME, stat, null);

代码示例来源:origin: ch.cern.hadoop/hadoop-common

byte[] data = zks.getZKDatabase().getData(
 parentDir + "/" +
 ActiveStandbyElector.LOCK_FILENAME, stat, null);

相关文章