code: @Override
      public void close() {
          if (!this.closed) {
              this.closed = true;
  
              // If we have already returned a result but it hasn't been consumed yet, cancel it.
              CompletableFuture<ReadResultEntryContents> lastReturnedFuture = this.lastEntryFuture;
              if (lastReturnedFuture != null && !lastReturnedFuture.isDone()) {
                  lastReturnedFuture.cancel(true);
                  this.lastEntryFuture = null;
              }
  
              log.trace("{}.ReadResult[{}]: Closed.", this.traceObjectId, this.streamSegmentStartOffset);
          }
      }
docs: region AutoCloseable Implementation