class AbstractTailerPollingQueueEntryReader implements QueueEntryReader {

    private final ExcerptTailer tailer;
    private final Function<ExcerptTailer, DocumentContext> pollMethod;

    protected AbstractTailerPollingQueueEntryReader(ExcerptTailer tailer, Function<ExcerptTailer, DocumentContext> pollMethod) {
        this.tailer = tailer;
        this.pollMethod = pollMethod;
    }

    @Override
    public final boolean read() {<FILL_FUNCTION_BODY>}

    protected abstract void doRead(DocumentContext documentContext);
}

        try (DocumentContext dc = pollMethod.apply(tailer)) {
            if (!dc.isPresent()) {
                return false;
            }
            doRead(dc);
            return true;
        }
    
<no_super_class>