org.apache.pulsar.shade.org.apache.bookkeeper.client.api.LedgerEntries.iterator()

Here are the examples of the java api org.apache.pulsar.shade.org.apache.bookkeeper.client.api.LedgerEntries.iterator() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

17 Source : InputSplitReader.java
with Apache License 2.0
from streamnative

CompletableFuture<Object> getEntries(InputLedger info) {
    outstandingLedgerReads.incrementAndGet();
    return getLedgerHandle(info).thenComposeAsync(readHandle -> {
        try (LedgerEntries entries = readHandle.read(info.getStartEntryId(), info.getEndEntryId())) {
            entryQueue.fill(new MessagePreplacedingQueue.Supplier<Entry>() {

                private int i = 0;

                @Override
                public Entry get() {
                    EntryImpl impl = EntryImpl.create(entries.getEntry(i));
                    i++;
                    return impl;
                }
            }, Lists.newArrayList(entries.iterator()).size());
        } catch (Exception e) {
            throw new CompletionException(e);
        }
        return null;
    }, executor).whenComplete((t, throwable) -> {
        if (throwable != null) {
            log.error(String.format("Get entry failed due to %s", throwable.getMessage()), throwable);
        } else {
            log.info(String.format("Finished extracting entries for ledger %s", info.toString()));
            outstandingLedgerReads.decrementAndGet();
        }
    });
}