use of org.apache.bookkeeper.client.SyncCallbackUtils.SyncOpenCallback in project bookkeeper by apache.
the class BookKeeper method openLedgerNoRecovery.
/**
* Synchronous, unsafe open ledger call.
*
* @see #asyncOpenLedgerNoRecovery
* @param lId
* ledger identifier
* @param digestType
* digest type, either MAC or CRC32
* @param passwd
* password
* @return a handle to the open ledger
* @throws InterruptedException
* @throws BKException
*/
public LedgerHandle openLedgerNoRecovery(long lId, DigestType digestType, byte[] passwd) throws BKException, InterruptedException {
CompletableFuture<LedgerHandle> future = new CompletableFuture<>();
SyncOpenCallback result = new SyncOpenCallback(future);
/*
* Calls async open ledger
*/
asyncOpenLedgerNoRecovery(lId, digestType, passwd, result, null);
return SyncCallbackUtils.waitForResult(future);
}
use of org.apache.bookkeeper.client.SyncCallbackUtils.SyncOpenCallback in project bookkeeper by apache.
the class BookKeeperAdmin method openLedger.
/**
* Open a ledger as an administrator. This means that no digest password
* checks are done. Otherwise, the call is identical to
* BookKeeper#openLedger
*
* @param lId
* - ledger identifier
* @see BookKeeper#openLedger
*/
public LedgerHandle openLedger(final long lId) throws InterruptedException, BKException {
CompletableFuture<LedgerHandle> future = new CompletableFuture<>();
SyncOpenCallback result = new SyncOpenCallback(future);
new LedgerOpenOp(bkc, lId, result, null).initiate();
return SyncCallbackUtils.waitForResult(future);
}
use of org.apache.bookkeeper.client.SyncCallbackUtils.SyncOpenCallback in project bookkeeper by apache.
the class BookKeeper method openLedger.
/**
* Synchronous open ledger call.
*
* @see #asyncOpenLedger
* @param lId
* ledger identifier
* @param digestType
* digest type, either MAC or CRC32
* @param passwd
* password
* @return a handle to the open ledger
* @throws InterruptedException
* @throws BKException
*/
public LedgerHandle openLedger(long lId, DigestType digestType, byte[] passwd) throws BKException, InterruptedException {
CompletableFuture<LedgerHandle> future = new CompletableFuture<>();
SyncOpenCallback result = new SyncOpenCallback(future);
/*
* Calls async open ledger
*/
asyncOpenLedger(lId, digestType, passwd, result, null);
return SyncCallbackUtils.waitForResult(future);
}
use of org.apache.bookkeeper.client.SyncCallbackUtils.SyncOpenCallback in project bookkeeper by apache.
the class BookKeeperAdmin method openLedgerNoRecovery.
/**
* Open a ledger as an administrator without recovering the ledger. This
* means that no digest password checks are done. Otherwise, the call is
* identical to BookKeeper#openLedgerNoRecovery
*
* @param lId
* ledger identifier
* @see BookKeeper#openLedgerNoRecovery
*/
@SuppressWarnings("unchecked")
public LedgerHandle openLedgerNoRecovery(final long lId) throws InterruptedException, BKException {
CompletableFuture<LedgerHandle> future = new CompletableFuture<>();
SyncOpenCallback result = new SyncOpenCallback(future);
new LedgerOpenOp(bkc, lId, result, null).initiateWithoutRecovery();
return SyncCallbackUtils.waitForResult(future);
}
Aggregations