Search in sources :

Example 1 with PlayBackListener

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;
}
Also used : PlayBackListener(org.apache.zookeeper.server.persistence.FileTxnSnapLog.PlayBackListener) Record(org.apache.jute.Record) TxnHeader(org.apache.zookeeper.txn.TxnHeader)

Aggregations

Record (org.apache.jute.Record)1 PlayBackListener (org.apache.zookeeper.server.persistence.FileTxnSnapLog.PlayBackListener)1 TxnHeader (org.apache.zookeeper.txn.TxnHeader)1