code: @Override
      public void close() {
          synchronized (this.lock) {
              if (this.closed) {
                  return;
              }
  
              this.closed = true;
  
              // Cancel all pending reads and unregister them.
              ArrayList<Request> toClose = new ArrayList<>(this.pendingRequests.values());
              toClose.forEach(Request::cancel);
          }
      }
docs: region AutoCloseable Implementation