static LedgerHandle openFence(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
        try {
            return Exceptions.handleInterruptedCall(
                    () -> bookKeeper.openLedger(ledgerId, LEDGER_DIGEST_TYPE, config.getBKPassword()));
        } catch (BKException bkEx) {
            throw new DurableDataLogException(String.format("Unable to open-fence ledger %d.", ledgerId), bkEx);
        }
    }
static LedgerHandle openFence ( long ledgerId , BookKeeper bookKeeper , BookKeeperConfig config ) throws DurableDataLogException { try { return Exceptions . handleInterruptedCall ( ( ) -> bookKeeper . openLedger ( ledgerId , LEDGER_DIGEST_TYPE , config . getBKPassword ( ) ) ) ; } catch ( BKException bkEx ) { throw new DurableDataLogException ( String . format ( "Unable to open-fence ledger %d." , ledgerId ) , bkEx ) ; } }
Opens a ledger. This operation also fences out the ledger in case anyone else was writing to it.

@param ledgerId   The Id of the Ledger to open.
@param bookKeeper A references to the BookKeeper client to use.
@param config     Configuration to use.
@return A LedgerHandle for the newly opened ledger.
@throws DurableDataLogException If an exception occurred. The causing exception is wrapped inside it.