@Override @Synchronized public void setOffset(long offset) { log.trace("SetOffset {}", offset); Preconditions.checkArgument(offset >= 0); Exceptions.checkNotClosed(asyncInput.isClosed(), this); if (offset > this.offset) { receivedTruncated = false; } if (offset != this.offset) { this.offset = offset; buffer.clear(); receivedEndOfSegment = false; outstandingRequest = null; } }
@Override @Synchronized public CompletableFuture<Void> fillBuffer() { log.trace("Filling buffer {}", this); Exceptions.checkNotClosed(asyncInput.isClosed(), this); try { issueRequestIfNeeded(); while (dataWaitingToGoInBuffer()) { handleRequest(); } } catch (SegmentTruncatedException e) { log.warn("Encountered exception filling buffer", e); return CompletableFuture.completedFuture(null); } return outstandingRequest == null ? CompletableFuture.completedFuture(null) : outstandingRequest.thenRun(Runnables.doNothing()); }
@Synchronized public int read(ByteBuffer toFill, long timeout) throws EndOfSegmentException, SegmentTruncatedException { Exceptions.checkNotClosed(asyncInput.isClosed(), this); if (this.offset >= this.endOffset) { log.debug("All events up to the configured end offset:{} have been read", endOffset);