List of usage examples for org.apache.zookeeper.server.persistence FileSnap SNAP_MAGIC
int SNAP_MAGIC
To view the source code for org.apache.zookeeper.server.persistence FileSnap SNAP_MAGIC.
Click Source Link
From source file:com.linkedin.helix.tools.ZKLogFormatter.java
License:Apache License
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); }/*from w w w . j a v a 2s . c o m*/ SerializeUtils.deserializeSnapshot(dt, ia, sessions); if (bw != null) { bw.write(sessions.toString()); bw.newLine(); } else { System.out.println(sessions); } traverse(dt, 1, "/"); }