Java 类org.apache.zookeeper.data.StatPersisted 实例源码

项目:fuck_zookeeper    文件:UpgradeSnapShotV1.java   
/**
 * convert the old stat to new stat
 * @param oldStat the old stat
 * @return the new stat
 */
private StatPersisted convertStat(StatPersistedV1 oldStat) {
    StatPersisted stat = new StatPersisted();
    stat.setAversion(oldStat.getAversion());
    stat.setCtime(oldStat.getCtime());
    stat.setCversion(oldStat.getCversion());
    stat.setCzxid(oldStat.getCzxid());
    stat.setEphemeralOwner(oldStat.getEphemeralOwner());
    stat.setMtime(oldStat.getMtime());
    stat.setMzxid(oldStat.getMzxid());
    stat.setVersion(oldStat.getVersion());
    return stat;
}
项目:fuck_zookeeper    文件:UpgradeSnapShotV1.java   
/**
 * convert a given old datanode to new datanode
 * @param dt the new datatree
 * @param parent the parent of the datanode to be constructed
 * @param oldDataNode the old datanode 
 * @return the new datanode
 */
private DataNode convertDataNode(DataTree dt, DataNode parent, 
        DataNodeV1 oldDataNode) {
    StatPersisted stat = convertStat(oldDataNode.stat);
    DataNode dataNode =  new DataNode(parent, oldDataNode.data,
            dt.getACL(oldDataNode), stat);
    dataNode.setChildren(oldDataNode.children);
    return dataNode;
}
项目:fuck_zookeeper    文件:DataNode.java   
synchronized public void deserialize(InputArchive archive, String tag)
        throws IOException {
    archive.startRecord("node");
    data = archive.readBuffer("data");
    acl = archive.readLong("acl");
    stat = new StatPersisted();
    stat.deserialize(archive, "statpersisted");
    archive.endRecord("node");
}
项目:fuck_zookeeper    文件:DataTree.java   
static public void copyStatPersisted(StatPersisted from, StatPersisted 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());
}
项目:fuck_zookeeper    文件:DataTree.java   
/**
 * this method uses a stringbuilder to create a new path for children. This
 * is faster than string appends ( str1 + str2).
 *
 * @param oa
 *            OutputArchive to write to.
 * @param path
 *            a string builder.
 * @throws IOException
 * @throws InterruptedException
 */
void serializeNode(OutputArchive oa, StringBuilder path) throws IOException {
    String pathString = path.toString();
    DataNode node = getNode(pathString);
    if (node == null) {
        return;
    }
    String children[] = null;
    DataNode nodeCopy;
    synchronized (node) {
        scount++;
        StatPersisted statCopy = new StatPersisted();
        copyStatPersisted(node.stat, statCopy);
        //we do not need to make a copy of node.data because the contents
        //are never changed
        nodeCopy = new DataNode(node.parent, node.data, node.acl, statCopy);
        Set<String> childs = node.getChildren();
        if (childs != null) {
            children = childs.toArray(new String[childs.size()]);
        }
    }
    oa.writeString(pathString, "path");
    oa.writeRecord(nodeCopy, "node");
    path.append('/');
    int off = path.length();
    if (children != null) {
        for (String child : children) {
            // since this is single buffer being resused
            // we need
            // to truncate the previous bytes of string.
            path.delete(off, Integer.MAX_VALUE);
            path.append(child);
            serializeNode(oa, path);
        }
    }
}
项目:fuck_zookeeper    文件:SnapshotFormatter.java   
private void printStat(StatPersisted stat) {
    printHex("cZxid", stat.getCzxid());
    System.out.println("  ctime = " + new Date(stat.getCtime()).toString());
    printHex("mZxid", stat.getMzxid());
    System.out.println("  mtime = " + new Date(stat.getMtime()).toString());
    printHex("pZxid", stat.getPzxid());
    System.out.println("  cversion = " + stat.getCversion());
    System.out.println("  dataVersion = " + stat.getVersion());
    System.out.println("  aclVersion = " + stat.getAversion());
    printHex("ephemeralOwner", stat.getEphemeralOwner());
}
项目:fuck_zookeeper    文件:ZooKeeperServer.java   
ChangeRecord(long zxid, String path, StatPersisted stat, int childCount,
        List<ACL> acl) {
    this.zxid = zxid;
    this.path = path;
    this.stat = stat;
    this.childCount = childCount;
    this.acl = acl;
}
项目:fuck_zookeeper    文件:ZooKeeperServer.java   
@SuppressWarnings("unchecked")
ChangeRecord duplicate(long zxid) {
    StatPersisted stat = new StatPersisted();
    if (this.stat != null) {
        DataTree.copyStatPersisted(this.stat, stat);
    }
    return new ChangeRecord(zxid, path, stat, childCount,
            acl == null ? new ArrayList<ACL>() : new ArrayList(acl));
}
项目:https-github.com-apache-zookeeper    文件:DataNode.java   
private static long getClientEphemeralOwner(StatPersisted stat) {
    EphemeralType ephemeralType = EphemeralType.get(stat.getEphemeralOwner());
    if (ephemeralType != EphemeralType.NORMAL) {
        return 0;
    }
    return stat.getEphemeralOwner();
}
项目:https-github.com-apache-zookeeper    文件:DataNode.java   
synchronized public void deserialize(InputArchive archive, String tag)
        throws IOException {
    archive.startRecord("node");
    data = archive.readBuffer("data");
    acl = archive.readLong("acl");
    stat = new StatPersisted();
    stat.deserialize(archive, "statpersisted");
    archive.endRecord("node");
}
项目:https-github.com-apache-zookeeper    文件:DataTree.java   
static public void copyStatPersisted(StatPersisted from, StatPersisted 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());
}
项目:https-github.com-apache-zookeeper    文件:DataTree.java   
/**
 * this method uses a stringbuilder to create a new path for children. This
 * is faster than string appends ( str1 + str2).
 *
 * @param oa
 *            OutputArchive to write to.
 * @param path
 *            a string builder.
 * @throws IOException
 * @throws InterruptedException
 */
void serializeNode(OutputArchive oa, StringBuilder path) throws IOException {
    String pathString = path.toString();
    DataNode node = getNode(pathString);
    if (node == null) {
        return;
    }
    String children[] = null;
    DataNode nodeCopy;
    synchronized (node) {
        StatPersisted statCopy = new StatPersisted();
        copyStatPersisted(node.stat, statCopy);
        //we do not need to make a copy of node.data because the contents
        //are never changed
        nodeCopy = new DataNode(node.data, node.acl, statCopy);
        Set<String> childs = node.getChildren();
        children = childs.toArray(new String[childs.size()]);
    }
    oa.writeString(pathString, "path");
    oa.writeRecord(nodeCopy, "node");
    path.append('/');
    int off = path.length();
    for (String child : children) {
        // since this is single buffer being resused
        // we need
        // to truncate the previous bytes of string.
        path.delete(off, Integer.MAX_VALUE);
        path.append(child);
        serializeNode(oa, path);
    }
}
项目:https-github.com-apache-zookeeper    文件:SnapshotFormatter.java   
private void printStat(StatPersisted stat) {
    printHex("cZxid", stat.getCzxid());
    System.out.println("  ctime = " + new Date(stat.getCtime()).toString());
    printHex("mZxid", stat.getMzxid());
    System.out.println("  mtime = " + new Date(stat.getMtime()).toString());
    printHex("pZxid", stat.getPzxid());
    System.out.println("  cversion = " + stat.getCversion());
    System.out.println("  dataVersion = " + stat.getVersion());
    System.out.println("  aclVersion = " + stat.getAversion());
    printHex("ephemeralOwner", stat.getEphemeralOwner());
}
项目:https-github.com-apache-zookeeper    文件:ZooKeeperServer.java   
ChangeRecord(long zxid, String path, StatPersisted stat, int childCount,
        List<ACL> acl) {
    this.zxid = zxid;
    this.path = path;
    this.stat = stat;
    this.childCount = childCount;
    this.acl = acl;
}
项目:https-github.com-apache-zookeeper    文件:ZooKeeperServer.java   
ChangeRecord duplicate(long zxid) {
    StatPersisted stat = new StatPersisted();
    if (this.stat != null) {
        DataTree.copyStatPersisted(this.stat, stat);
    }
    return new ChangeRecord(zxid, path, stat, childCount,
            acl == null ? new ArrayList<ACL>() : new ArrayList<ACL>(acl));
}
项目:ZooKeeper    文件:UpgradeSnapShotV1.java   
/**
 * convert the old stat to new stat
 * @param oldStat the old stat
 * @return the new stat
 */
private StatPersisted convertStat(StatPersistedV1 oldStat) {
    StatPersisted stat = new StatPersisted();
    stat.setAversion(oldStat.getAversion());
    stat.setCtime(oldStat.getCtime());
    stat.setCversion(oldStat.getCversion());
    stat.setCzxid(oldStat.getCzxid());
    stat.setEphemeralOwner(oldStat.getEphemeralOwner());
    stat.setMtime(oldStat.getMtime());
    stat.setMzxid(oldStat.getMzxid());
    stat.setVersion(oldStat.getVersion());
    return stat;
}
项目:ZooKeeper    文件:UpgradeSnapShotV1.java   
/**
 * convert a given old datanode to new datanode
 * @param dt the new datatree
 * @param parent the parent of the datanode to be constructed
 * @param oldDataNode the old datanode 
 * @return the new datanode
 */
private DataNode convertDataNode(DataTree dt, DataNode parent, 
        DataNodeV1 oldDataNode) {
    StatPersisted stat = convertStat(oldDataNode.stat);
    DataNode dataNode =  new DataNode(parent, oldDataNode.data,
            dt.getACL(oldDataNode), stat);
    dataNode.setChildren(oldDataNode.children);
    return dataNode;
}
项目:ZooKeeper    文件:DataNode.java   
synchronized public void deserialize(InputArchive archive, String tag)
        throws IOException {
    archive.startRecord("node");
    data = archive.readBuffer("data");
    acl = archive.readLong("acl");
    stat = new StatPersisted();
    stat.deserialize(archive, "statpersisted");
    archive.endRecord("node");
}
项目:ZooKeeper    文件:DataTree.java   
static public void copyStatPersisted(StatPersisted from, StatPersisted 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());
}
项目:ZooKeeper    文件:DataTree.java   
/**
 * this method uses a stringbuilder to create a new path for children. This
 * is faster than string appends ( str1 + str2).
 *
 * @param oa
 *            OutputArchive to write to.
 * @param path
 *            a string builder.
 * @throws IOException
 * @throws InterruptedException
 */
void serializeNode(OutputArchive oa, StringBuilder path) throws IOException {
    String pathString = path.toString();
    DataNode node = getNode(pathString);
    if (node == null) {
        return;
    }
    String children[] = null;
    DataNode nodeCopy;
    synchronized (node) {
        scount++;
        StatPersisted statCopy = new StatPersisted();
        copyStatPersisted(node.stat, statCopy);
        //we do not need to make a copy of node.data because the contents
        //are never changed
        nodeCopy = new DataNode(node.parent, node.data, node.acl, statCopy);
        Set<String> childs = node.getChildren();
        children = childs.toArray(new String[childs.size()]);
    }
    oa.writeString(pathString, "path");
    oa.writeRecord(nodeCopy, "node");
    path.append('/');
    int off = path.length();
    for (String child : children) {
        // since this is single buffer being resused
        // we need
        // to truncate the previous bytes of string.
        path.delete(off, Integer.MAX_VALUE);
        path.append(child);
        serializeNode(oa, path);
    }
}
项目:ZooKeeper    文件:SnapshotFormatter.java   
private void printStat(StatPersisted stat) {
    printHex("cZxid", stat.getCzxid());
    System.out.println("  ctime = " + new Date(stat.getCtime()).toString());
    printHex("mZxid", stat.getMzxid());
    System.out.println("  mtime = " + new Date(stat.getMtime()).toString());
    printHex("pZxid", stat.getPzxid());
    System.out.println("  cversion = " + stat.getCversion());
    System.out.println("  dataVersion = " + stat.getVersion());
    System.out.println("  aclVersion = " + stat.getAversion());
    printHex("ephemeralOwner", stat.getEphemeralOwner());
}
项目:ZooKeeper    文件:ZooKeeperServer.java   
ChangeRecord(long zxid, String path, StatPersisted stat, int childCount,
        List<ACL> acl) {
    this.zxid = zxid;
    this.path = path;
    this.stat = stat;
    this.childCount = childCount;
    this.acl = acl;
}
项目:ZooKeeper    文件:ZooKeeperServer.java   
@SuppressWarnings("unchecked")
ChangeRecord duplicate(long zxid) {
    StatPersisted stat = new StatPersisted();
    if (this.stat != null) {
        DataTree.copyStatPersisted(this.stat, stat);
    }
    return new ChangeRecord(zxid, path, stat, childCount,
            acl == null ? new ArrayList<ACL>() : new ArrayList(acl));
}
项目:StreamProcessingInfrastructure    文件:UpgradeSnapShotV1.java   
/**
 * convert the old stat to new stat
 * @param oldStat the old stat
 * @return the new stat
 */
private StatPersisted convertStat(StatPersistedV1 oldStat) {
    StatPersisted stat = new StatPersisted();
    stat.setAversion(oldStat.getAversion());
    stat.setCtime(oldStat.getCtime());
    stat.setCversion(oldStat.getCversion());
    stat.setCzxid(oldStat.getCzxid());
    stat.setEphemeralOwner(oldStat.getEphemeralOwner());
    stat.setMtime(oldStat.getMtime());
    stat.setMzxid(oldStat.getMzxid());
    stat.setVersion(oldStat.getVersion());
    return stat;
}
项目:StreamProcessingInfrastructure    文件:UpgradeSnapShotV1.java   
/**
 * convert a given old datanode to new datanode
 * @param dt the new datatree
 * @param parent the parent of the datanode to be constructed
 * @param oldDataNode the old datanode 
 * @return the new datanode
 */
private DataNode convertDataNode(DataTree dt, DataNode parent, 
        DataNodeV1 oldDataNode) {
    StatPersisted stat = convertStat(oldDataNode.stat);
    DataNode dataNode =  new DataNode(parent, oldDataNode.data,
            dt.getACL(oldDataNode), stat);
    dataNode.setChildren(oldDataNode.children);
    return dataNode;
}
项目:StreamProcessingInfrastructure    文件:DataNode.java   
synchronized public void deserialize(InputArchive archive, String tag)
        throws IOException {
    archive.startRecord("node");
    data = archive.readBuffer("data");
    acl = archive.readLong("acl");
    stat = new StatPersisted();
    stat.deserialize(archive, "statpersisted");
    archive.endRecord("node");
}
项目:StreamProcessingInfrastructure    文件:DataTree.java   
static public void copyStatPersisted(StatPersisted from, StatPersisted 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());
}
项目:StreamProcessingInfrastructure    文件:DataTree.java   
/**
 * this method uses a stringbuilder to create a new path for children. This
 * is faster than string appends ( str1 + str2).
 *
 * @param oa
 *            OutputArchive to write to.
 * @param path
 *            a string builder.
 * @throws IOException
 * @throws InterruptedException
 */
void serializeNode(OutputArchive oa, StringBuilder path) throws IOException {
    String pathString = path.toString();
    DataNode node = getNode(pathString);
    if (node == null) {
        return;
    }
    String children[] = null;
    DataNode nodeCopy;
    synchronized (node) {
        scount++;
        StatPersisted statCopy = new StatPersisted();
        copyStatPersisted(node.stat, statCopy);
        //we do not need to make a copy of node.data because the contents
        //are never changed
        nodeCopy = new DataNode(node.parent, node.data, node.acl, statCopy);
        Set<String> childs = node.getChildren();
        if (childs != null) {
            children = childs.toArray(new String[childs.size()]);
        }
    }
    oa.writeString(pathString, "path");
    oa.writeRecord(nodeCopy, "node");
    path.append('/');
    int off = path.length();
    if (children != null) {
        for (String child : children) {
            // since this is single buffer being resused
            // we need
            // to truncate the previous bytes of string.
            path.delete(off, Integer.MAX_VALUE);
            path.append(child);
            serializeNode(oa, path);
        }
    }
}
项目:StreamProcessingInfrastructure    文件:SnapshotFormatter.java   
private void printStat(StatPersisted stat) {
    printHex("cZxid", stat.getCzxid());
    System.out.println("  ctime = " + new Date(stat.getCtime()).toString());
    printHex("mZxid", stat.getMzxid());
    System.out.println("  mtime = " + new Date(stat.getMtime()).toString());
    printHex("pZxid", stat.getPzxid());
    System.out.println("  cversion = " + stat.getCversion());
    System.out.println("  dataVersion = " + stat.getVersion());
    System.out.println("  aclVersion = " + stat.getAversion());
    printHex("ephemeralOwner", stat.getEphemeralOwner());
}
项目:StreamProcessingInfrastructure    文件:ZooKeeperServer.java   
ChangeRecord(long zxid, String path, StatPersisted stat, int childCount,
        List<ACL> acl) {
    this.zxid = zxid;
    this.path = path;
    this.stat = stat;
    this.childCount = childCount;
    this.acl = acl;
}
项目:StreamProcessingInfrastructure    文件:ZooKeeperServer.java   
@SuppressWarnings("unchecked")
ChangeRecord duplicate(long zxid) {
    StatPersisted stat = new StatPersisted();
    if (this.stat != null) {
        DataTree.copyStatPersisted(this.stat, stat);
    }
    return new ChangeRecord(zxid, path, stat, childCount,
            acl == null ? new ArrayList<ACL>() : new ArrayList(acl));
}
项目:bigstreams    文件:UpgradeSnapShotV1.java   
/**
 * convert the old stat to new stat
 * @param oldStat the old stat
 * @return the new stat
 */
private StatPersisted convertStat(StatPersistedV1 oldStat) {
    StatPersisted stat = new StatPersisted();
    stat.setAversion(oldStat.getAversion());
    stat.setCtime(oldStat.getCtime());
    stat.setCversion(oldStat.getCversion());
    stat.setCzxid(oldStat.getCzxid());
    stat.setEphemeralOwner(oldStat.getEphemeralOwner());
    stat.setMtime(oldStat.getMtime());
    stat.setMzxid(oldStat.getMzxid());
    stat.setVersion(oldStat.getVersion());
    return stat;
}
项目:bigstreams    文件:UpgradeSnapShotV1.java   
/**
 * convert a given old datanode to new datanode
 * @param dt the new datatree
 * @param parent the parent of the datanode to be constructed
 * @param oldDataNode the old datanode 
 * @return the new datanode
 */
private DataNode convertDataNode(DataTree dt, DataNode parent, 
        DataNodeV1 oldDataNode) {
    StatPersisted stat = convertStat(oldDataNode.stat);
    DataNode dataNode =  new DataNode(parent, oldDataNode.data,
            dt.convertAcls(oldDataNode.acl), stat);
    dataNode.setChildren(oldDataNode.children);
    return dataNode;
}
项目:bigstreams    文件:DataNode.java   
synchronized public void deserialize(InputArchive archive, String tag)
        throws IOException {
    archive.startRecord("node");
    data = archive.readBuffer("data");
    acl = archive.readLong("acl");
    stat = new StatPersisted();
    stat.deserialize(archive, "statpersisted");
    archive.endRecord("node");
}
项目:bigstreams    文件:DataTree.java   
static public void copyStatPersisted(StatPersisted from, StatPersisted 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());
}
项目:bigstreams    文件:SnapshotFormatter.java   
private void printStat(StatPersisted stat) {
    printHex("cZxid", stat.getCzxid());
    System.out.println("  ctime = " + new Date(stat.getCtime()).toString());
    printHex("mZxid", stat.getMzxid());
    System.out.println("  mtime = " + new Date(stat.getMtime()).toString());
    printHex("pZxid", stat.getPzxid());
    System.out.println("  cversion = " + stat.getCversion());
    System.out.println("  dataVersion = " + stat.getVersion());
    System.out.println("  aclVersion = " + stat.getAversion());
    printHex("ephemeralOwner", stat.getEphemeralOwner());
}
项目:bigstreams    文件:ZooKeeperServer.java   
ChangeRecord(long zxid, String path, StatPersisted stat, int childCount,
        List<ACL> acl) {
    this.zxid = zxid;
    this.path = path;
    this.stat = stat;
    this.childCount = childCount;
    this.acl = acl;
}
项目:bigstreams    文件:ZooKeeperServer.java   
@SuppressWarnings("unchecked")
ChangeRecord duplicate(long zxid) {
    StatPersisted stat = new StatPersisted();
    if (this.stat != null) {
        DataTree.copyStatPersisted(this.stat, stat);
    }
    return new ChangeRecord(zxid, path, stat, childCount,
            acl == null ? new ArrayList<ACL>() : new ArrayList(acl));
}
项目:bigstreams    文件:UpgradeSnapShotV1.java   
/**
 * convert the old stat to new stat
 * @param oldStat the old stat
 * @return the new stat
 */
private StatPersisted convertStat(StatPersistedV1 oldStat) {
    StatPersisted stat = new StatPersisted();
    stat.setAversion(oldStat.getAversion());
    stat.setCtime(oldStat.getCtime());
    stat.setCversion(oldStat.getCversion());
    stat.setCzxid(oldStat.getCzxid());
    stat.setEphemeralOwner(oldStat.getEphemeralOwner());
    stat.setMtime(oldStat.getMtime());
    stat.setMzxid(oldStat.getMzxid());
    stat.setVersion(oldStat.getVersion());
    return stat;
}
项目:bigstreams    文件:UpgradeSnapShotV1.java   
/**
 * convert a given old datanode to new datanode
 * @param dt the new datatree
 * @param parent the parent of the datanode to be constructed
 * @param oldDataNode the old datanode 
 * @return the new datanode
 */
private DataNode convertDataNode(DataTree dt, DataNode parent, 
        DataNodeV1 oldDataNode) {
    StatPersisted stat = convertStat(oldDataNode.stat);
    DataNode dataNode =  new DataNode(parent, oldDataNode.data,
            dt.convertAcls(oldDataNode.acl), stat);
    dataNode.setChildren(oldDataNode.children);
    return dataNode;
}