use of org.apache.bookkeeper.client.LedgerFragmentReplicator.SingleFragmentCallback in project bookkeeper by apache.
the class BookKeeperAdmin method replicateLedgerFragment.
private void replicateLedgerFragment(LedgerHandle lh, final LedgerFragment ledgerFragment, final Map<Integer, BookieSocketAddress> targetBookieAddresses) throws InterruptedException, BKException {
CompletableFuture<Void> result = new CompletableFuture<>();
ResultCallBack resultCallBack = new ResultCallBack(result);
SingleFragmentCallback cb = new SingleFragmentCallback(resultCallBack, lh, ledgerFragment.getFirstEntryId(), getReplacementBookiesMap(ledgerFragment, targetBookieAddresses));
Set<BookieSocketAddress> targetBookieSet = Sets.newHashSet();
targetBookieSet.addAll(targetBookieAddresses.values());
asyncRecoverLedgerFragment(lh, ledgerFragment, cb, targetBookieSet);
try {
SyncCallbackUtils.waitForResult(result);
} catch (BKException err) {
throw BKException.create(bkc.getReturnRc(err.getCode()));
}
}
Aggregations