use of org.apache.zookeeper.server.persistence.FileTxnSnapLog.PlayBackListener in project zookeeper by apache.
the class ZKDatabase method loadDataBase.
/**
* load the database from the disk onto memory and also add
* the transactions to the committedlog in memory.
* @return the last valid zxid on disk
* @throws IOException
*/
public long loadDataBase() throws IOException {
PlayBackListener listener = new PlayBackListener() {
public void onTxnLoaded(TxnHeader hdr, Record txn) {
Request r = new Request(0, hdr.getCxid(), hdr.getType(), hdr, txn, hdr.getZxid());
addCommittedProposal(r);
}
};
long zxid = snapLog.restore(dataTree, sessionsWithTimeouts, listener);
initialized = true;
return zxid;
}
Aggregations