Search in sources :

Example 1 with LogSegmentEntryReader

use of org.apache.distributedlog.logsegment.LogSegmentEntryReader in project bookkeeper by apache.

the class BKLogSegmentEntryStore method openComplete.

@Override
public void openComplete(int rc, LedgerHandle lh, Object ctx) {
    OpenReaderRequest request = (OpenReaderRequest) ctx;
    if (BKException.Code.OK != rc) {
        FutureUtils.completeExceptionally(request.openPromise, new BKTransmitException("Failed to open ledger handle for log segment " + request.segment, rc));
        return;
    }
    // successfully open a ledger
    try {
        LogSegmentEntryReader reader = new BKLogSegmentEntryReader(request.segment, lh, request.startEntryId, bkc.get(), scheduler, conf, statsLogger, failureInjector);
        FutureUtils.complete(request.openPromise, reader);
    } catch (IOException e) {
        FutureUtils.completeExceptionally(request.openPromise, e);
    }
}
Also used : LogSegmentEntryReader(org.apache.distributedlog.logsegment.LogSegmentEntryReader) BKTransmitException(org.apache.distributedlog.exceptions.BKTransmitException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 BKTransmitException (org.apache.distributedlog.exceptions.BKTransmitException)1 LogSegmentEntryReader (org.apache.distributedlog.logsegment.LogSegmentEntryReader)1