new ReadLastConfirmedOp(lh, readLACCallback).initiate();
public CompletableFuture<LedgerHandle> initiate() { ReadLastConfirmedOp rlcop = new ReadLastConfirmedOp(lh, clientCtx.getBookieClient(), lh.getCurrentEnsemble(), new ReadLastConfirmedOp.LastConfirmedDataCallback() { public void readLastConfirmedDataComplete(int rc, RecoveryData data) { if (rc == BKException.Code.OK) { synchronized (lh) { lh.lastAddPushed = lh.lastAddConfirmed = data.getLastAddConfirmed(); lh.length = data.getLength(); lh.pendingAddsSequenceHead = lh.lastAddConfirmed; startEntryToRead = endEntryToRead = lh.lastAddConfirmed; } // keep a copy of ledger metadata before proceeding // ledger recovery metadataForRecovery = lh.getLedgerMetadata(); doRecoveryRead(); } else if (rc == BKException.Code.UnauthorizedAccessException) { submitCallback(rc); } else { submitCallback(BKException.Code.ReadException); } } }); /** * Enable fencing on this op. When the read request reaches the bookies * server it will fence off the ledger, stopping any subsequent operation * from writing to it. */ rlcop.initiateWithFencing(); return promise; }
new ReadLastConfirmedOp(this, clientCtx.getBookieClient(), getCurrentEnsemble(), innercb).initiate();
}; new ReadLastConfirmedOp(lh, clientCtx.getBookieClient(), lh.getCurrentEnsemble(), readLACCallback).initiate();