本文整理汇总了Java中org.apache.zookeeper.data.StatPersistedV1.setCzxid方法的典型用法代码示例。如果您正苦于以下问题:Java StatPersistedV1.setCzxid方法的具体用法?Java StatPersistedV1.setCzxid怎么用?Java StatPersistedV1.setCzxid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.data.StatPersistedV1
的用法示例。
在下文中一共展示了StatPersistedV1.setCzxid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyStatPersisted
import org.apache.zookeeper.data.StatPersistedV1; //导入方法依赖的package包/类
static public void copyStatPersisted(StatPersistedV1 from, StatPersistedV1 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());
}
示例2: createNode
import org.apache.zookeeper.data.StatPersistedV1; //导入方法依赖的package包/类
/**
* @param path
* @param data
* @param acl
* @param ephemeralOwner
* the session id that owns this node. -1 indicates this is
* not an ephemeral node.
* @param zxid
* @param time
* @return the patch of the created node
* @throws KeeperException
*/
public String createNode(String path, byte data[], List<ACL> acl,
long ephemeralOwner, long zxid, long time)
throws KeeperException.NoNodeException, KeeperException.NodeExistsException {
int lastSlash = path.lastIndexOf('/');
String parentName = path.substring(0, lastSlash);
String childName = path.substring(lastSlash + 1);
StatPersistedV1 stat = new StatPersistedV1();
stat.setCtime(time);
stat.setMtime(time);
stat.setCzxid(zxid);
stat.setMzxid(zxid);
stat.setVersion(0);
stat.setAversion(0);
stat.setEphemeralOwner(ephemeralOwner);
DataNodeV1 parent = nodes.get(parentName);
if (parent == null) {
throw new KeeperException.NoNodeException();
}
synchronized (parent) {
if (parent.children.contains(childName)) {
throw new KeeperException.NodeExistsException();
}
int cver = parent.stat.getCversion();
cver++;
parent.stat.setCversion(cver);
DataNodeV1 child = new DataNodeV1(parent, data, acl, stat);
parent.children.add(childName);
nodes.put(path, child);
if (ephemeralOwner != 0) {
HashSet<String> list = ephemerals.get(ephemeralOwner);
if (list == null) {
list = new HashSet<String>();
ephemerals.put(ephemeralOwner, list);
}
synchronized(list) {
list.add(path);
}
}
}
dataWatches.triggerWatch(path, Event.EventType.NodeCreated);
childWatches.triggerWatch(parentName.equals("")?"/":parentName, Event.EventType.NodeChildrenChanged);
return path;
}