本文整理了Java中org.apache.zookeeper.data.Stat.getMzxid()
方法的一些代码示例,展示了Stat.getMzxid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stat.getMzxid()
方法的具体详情如下:
包路径:org.apache.zookeeper.data.Stat
类名称:Stat
方法名:getMzxid
暂无
代码示例来源:origin: apache/zookeeper
@Override
public int hashCode() {
return (int) (getType() * 35 + path.hashCode() +
(stat == null ? 0 : stat.getMzxid()));
}
}
代码示例来源:origin: apache/zookeeper
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SetDataResult)) return false;
SetDataResult other = (SetDataResult) o;
return getType() == other.getType() && stat.getMzxid() == other.stat.getMzxid();
}
代码示例来源:origin: apache/zookeeper
@Override
public int hashCode() {
return (int) (getType() * 35 + stat.getMzxid());
}
}
代码示例来源:origin: apache/zookeeper
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof CreateResult)) return false;
CreateResult other = (CreateResult) o;
boolean statsAreEqual = (stat == null && other.stat == null ||
(stat != null && other.stat != null &&
stat.getMzxid() == other.stat.getMzxid()));
return getType() == other.getType() &&
path.equals(other.getPath()) && statsAreEqual;
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
@Override
public int hashCode() {
return (int) (getType() * 35 + stat.getMzxid());
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SetDataResult)) return false;
SetDataResult other = (SetDataResult) o;
return getType() == other.getType() && stat.getMzxid() == other.stat.getMzxid();
}
代码示例来源:origin: apache/zookeeper
public void print(Stat stat) {
out.println("cZxid = 0x" + Long.toHexString(stat.getCzxid()));
out.println("ctime = " + new Date(stat.getCtime()).toString());
out.println("mZxid = 0x" + Long.toHexString(stat.getMzxid()));
out.println("mtime = " + new Date(stat.getMtime()).toString());
out.println("pZxid = 0x" + Long.toHexString(stat.getPzxid()));
out.println("cversion = " + stat.getCversion());
out.println("dataVersion = " + stat.getVersion());
out.println("aclVersion = " + stat.getAversion());
out.println("ephemeralOwner = 0x"
+ Long.toHexString(stat.getEphemeralOwner()));
out.println("dataLength = " + stat.getDataLength());
out.println("numChildren = " + stat.getNumChildren());
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
private static void printStat(Stat stat) {
System.err.println("cZxid = 0x" + Long.toHexString(stat.getCzxid()));
System.err.println("ctime = " + new Date(stat.getCtime()).toString());
System.err.println("mZxid = 0x" + Long.toHexString(stat.getMzxid()));
System.err.println("mtime = " + new Date(stat.getMtime()).toString());
System.err.println("pZxid = 0x" + Long.toHexString(stat.getPzxid()));
System.err.println("cversion = " + stat.getCversion());
System.err.println("dataVersion = " + stat.getVersion());
System.err.println("aclVersion = " + stat.getAversion());
System.err.println("ephemeralOwner = 0x"
+ Long.toHexString(stat.getEphemeralOwner()));
System.err.println("dataLength = " + stat.getDataLength());
System.err.println("numChildren = " + stat.getNumChildren());
}
代码示例来源:origin: apache/incubator-druid
@Test
public void testLeavesBehindTurdlingsThatAlreadyExisted() throws Exception
{
curator.start();
curator.blockUntilConnected();
Announcer announcer = new Announcer(curator, exec);
final byte[] billy = StringUtils.toUtf8("billy");
final String testPath = "/somewhere/test2";
final String parent = ZKPaths.getPathAndNode(testPath).getPath();
curator.create().forPath(parent);
final Stat initialStat = curator.checkExists().forPath(parent);
announcer.start();
try {
Assert.assertEquals(initialStat.getMzxid(), curator.checkExists().forPath(parent).getMzxid());
awaitAnnounce(announcer, testPath, billy, true);
Assert.assertEquals(initialStat.getMzxid(), curator.checkExists().forPath(parent).getMzxid());
}
finally {
announcer.stop();
}
Assert.assertEquals(initialStat.getMzxid(), curator.checkExists().forPath(parent).getMzxid());
}
代码示例来源:origin: apache/zookeeper
/**
* ZOOKEEPER-1573: test restoring a snapshot with deleted txns ahead of the
* snapshot file's zxid.
*/
@Test
public void testReloadSnapshotWithMissingParent() throws Exception {
// create transactions to create the snapshot with create/delete pattern
ZooKeeper zk = createZKClient(hostPort);
zk.create("/a", "".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
Stat stat = zk.exists("/a", false);
long createZxId = stat.getMzxid();
zk.create("/a/b", "".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
zk.delete("/a/b", -1);
zk.delete("/a", -1);
// force the zxid to be behind the content
ZooKeeperServer zks = getServer(serverFactory);
zks.getZKDatabase().setlastProcessedZxid(createZxId);
LOG.info("Set lastProcessedZxid to {}", zks.getZKDatabase()
.getDataTreeLastProcessedZxid());
// Force snapshot and restore
zks.takeSnapshot();
zks.shutdown();
stopServer();
startServer();
}
}
代码示例来源:origin: apache/zookeeper
@Test
public void testChildren()
throws IOException, KeeperException, InterruptedException
{
String name = "/foo";
zk.create(name, name.getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
for(int i = 0; i < 10; i++) {
String childname = name + "/bar" + i;
zk.create(childname, childname.getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.EPHEMERAL);
Stat stat;
stat = newStat();
zk.getData(name, false, stat);
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid() + i + 1, stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
Assert.assertEquals(i + 1, stat.getCversion());
Assert.assertEquals(0, stat.getVersion());
Assert.assertEquals(0, stat.getAversion());
Assert.assertEquals(0, stat.getEphemeralOwner());
Assert.assertEquals(name.length(), stat.getDataLength());
Assert.assertEquals(i + 1, stat.getNumChildren());
}
}
代码示例来源:origin: apache/zookeeper
@Test
public void testBasic()
throws IOException, KeeperException, InterruptedException
{
String name = "/foo";
zk.create(name, name.getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
Stat stat;
stat = newStat();
zk.getData(name, false, stat);
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid(), stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
Assert.assertEquals(0, stat.getCversion());
Assert.assertEquals(0, stat.getVersion());
Assert.assertEquals(0, stat.getAversion());
Assert.assertEquals(0, stat.getEphemeralOwner());
Assert.assertEquals(name.length(), stat.getDataLength());
Assert.assertEquals(0, stat.getNumChildren());
}
代码示例来源:origin: apache/zookeeper
List<String> s = zk.getChildren(name, false, stat);
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid() + 1, stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid(), stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
代码示例来源:origin: apache/zookeeper
static public void copyStat(Stat from, Stat to) {
to.setAversion(from.getAversion());
to.setCtime(from.getCtime());
to.setCversion(from.getCversion());
to.setCzxid(from.getCzxid());
to.setMtime(from.getMtime());
to.setMzxid(from.getMzxid());
to.setPzxid(from.getPzxid());
to.setVersion(from.getVersion());
to.setEphemeralOwner(from.getEphemeralOwner());
to.setDataLength(from.getDataLength());
to.setNumChildren(from.getNumChildren());
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
static public void copyStat(Stat from, Stat to) {
to.setAversion(from.getAversion());
to.setCtime(from.getCtime());
to.setCversion(from.getCversion());
to.setCzxid(from.getCzxid());
to.setMtime(from.getMtime());
to.setMzxid(from.getMzxid());
to.setVersion(from.getVersion());
to.setEphemeralOwner(from.getEphemeralOwner());
to.setDataLength(from.getDataLength());
to.setNumChildren(from.getNumChildren());
}
代码示例来源:origin: apache/zookeeper
zk.getData(name, false, stat);
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid() + 1, stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
zk.getData(childname, false, stat);
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid(), stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
代码示例来源:origin: apache/zookeeper
zk.getData(name, false, stat);
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid(), stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
zk.getData(name, false, stat);
Assert.assertNotSame(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid(), stat.getPzxid());
Assert.assertNotSame(stat.getCtime(), stat.getMtime());
代码示例来源:origin: apache/zookeeper
private void validateCreateStat(Stat stat, String name) {
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid(), stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
Assert.assertEquals(0, stat.getCversion());
Assert.assertEquals(0, stat.getVersion());
Assert.assertEquals(0, stat.getAversion());
Assert.assertEquals(0, stat.getEphemeralOwner());
Assert.assertEquals(name.length(), stat.getDataLength());
Assert.assertEquals(0, stat.getNumChildren());
}
}
代码示例来源:origin: apache/zookeeper
private void validateCreateStat(Stat stat, String name) {
Assert.assertEquals(stat.getCzxid(), stat.getMzxid());
Assert.assertEquals(stat.getCzxid(), stat.getPzxid());
Assert.assertEquals(stat.getCtime(), stat.getMtime());
Assert.assertEquals(0, stat.getCversion());
Assert.assertEquals(0, stat.getVersion());
Assert.assertEquals(0, stat.getAversion());
Assert.assertEquals(0, stat.getEphemeralOwner());
Assert.assertEquals(name.length(), stat.getDataLength());
Assert.assertEquals(0, stat.getNumChildren());
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
static public void copyStat(Stat from, Stat to) {
to.setAversion(from.getAversion());
to.setCtime(from.getCtime());
to.setCversion(from.getCversion());
to.setCzxid(from.getCzxid());
to.setMtime(from.getMtime());
to.setMzxid(from.getMzxid());
to.setPzxid(from.getPzxid());
to.setVersion(from.getVersion());
to.setEphemeralOwner(from.getEphemeralOwner());
to.setDataLength(from.getDataLength());
to.setNumChildren(from.getNumChildren());
}
内容来源于网络,如有侵权,请联系作者删除!