For IntelliJ IDEA,
Android Studio or Eclipse



/** * Synchronous call to delete a ledger. Parameters match those of * {@link #asyncDeleteLedger(long, AsyncCallback.DeleteCallback, Object)} * * @param lId * ledgerId * @throws InterruptedException * @throws BKException.BKNoSuchLedgerExistsException if the ledger doesn't exist * @throws BKException */ @SuppressWarnings("unchecked") public void deleteLedger(long lId) throws InterruptedException, BKException { CompletableFuture<Void> future = new CompletableFuture<>(); SyncDeleteCallback result = new SyncDeleteCallback(future); // Call asynchronous version asyncDeleteLedger(lId, result, null); SyncCallbackUtils.waitForResult(future); }
/** * Synchronous call to delete a ledger. Parameters match those of * {@link #asyncDeleteLedger(long, AsyncCallback.DeleteCallback, Object)} * * @param lId * ledgerId * @throws InterruptedException * @throws BKException.BKNoSuchLedgerExistsException if the ledger doesn't exist * @throws BKException */ public void deleteLedger(long lId) throws InterruptedException, BKException { SyncCounter counter = new SyncCounter(); counter.inc(); // Call asynchronous version asyncDeleteLedger(lId, new SyncDeleteCallback(), counter); // Wait counter.block(0); if (counter.getrc() != BKException.Code.OK) { LOG.error("Error deleting ledger " + lId + " : " + counter.getrc()); throw BKException.create(counter.getrc()); } }
bk.asyncDeleteLedger(lh.getId(), cb, openLatch);