Java 类org.apache.zookeeper.server.persistence.FileSnap 实例源码

项目:fuck_zookeeper    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:https-github.com-apache-zookeeper    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:ZooKeeper    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:StreamProcessingInfrastructure    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:bigstreams    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:bigstreams    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:zookeeper    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:SecureKeeper    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:SecureKeeper    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:StreamBench    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:helix    文件:ZKLogFormatter.java   
private static void readSnapshotLog(String snapshotPath) throws Exception {
  FileInputStream fis = new FileInputStream(snapshotPath);
  BinaryInputArchive ia = BinaryInputArchive.getArchive(fis);
  Map<Long, Integer> sessions = new HashMap<Long, Integer>();
  DataTree dt = new DataTree();
  FileHeader header = new FileHeader();
  header.deserialize(ia, "fileheader");
  if (header.getMagic() != FileSnap.SNAP_MAGIC) {
    throw new IOException("mismatching magic headers " + header.getMagic() + " !=  "
        + FileSnap.SNAP_MAGIC);
  }
  SerializeUtils.deserializeSnapshot(dt, ia, sessions);

  if (bw != null) {
    bw.write(sessions.toString());
    bw.newLine();
  } else {
    System.out.println(sessions);
  }
  traverse(dt, 1, "/");

}
项目:LoadBalanced_zk    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:LoadBalanced_zk    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:zookeeper.dsc    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:zookeeper-pkg    文件:CRCTest.java   
/** return if checksum matches for a snapshot **/
private boolean getCheckSum(FileSnap snap, File snapFile) throws IOException {
    DataTree dt = new DataTree();
    Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
    InputStream snapIS = new BufferedInputStream(new FileInputStream(
            snapFile));
    CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(crcIn);
    try {
        snap.deserialize(dt, sessions, ia);
    } catch (IOException ie) {
        // we failed on the most recent snapshot
        // must be incomplete
        // try reading the next one
        // after corrupting
        snapIS.close();
        crcIn.close();
        throw ie;
    }

    long checksum = crcIn.getChecksum().getValue();
    long val = ia.readLong("val");
    snapIS.close();
    crcIn.close();
    return (val != checksum);
}
项目:fuck_zookeeper    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:https-github.com-apache-zookeeper    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:ZooKeeper    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:StreamProcessingInfrastructure    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:bigstreams    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:zookeeper-src-learning    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:zookeeper    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:SecureKeeper    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:SecureKeeper    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:StreamBench    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:ACaZoo    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:LoadBalanced_zk    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:LoadBalanced_zk    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}
项目:zookeeper-pkg    文件:SnapshotFormatter.java   
public void run(String snapshotFileName) throws IOException {
    InputStream is = new CheckedInputStream(
            new BufferedInputStream(new FileInputStream(snapshotFileName)),
            new Adler32());
    InputArchive ia = BinaryInputArchive.getArchive(is);

    FileSnap fileSnap = new FileSnap(null);

    DataTree dataTree = new DataTree();
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();

    fileSnap.deserialize(dataTree, sessions, ia);

    printDetails(dataTree, sessions);
}