code: public CompletableFuture<Queue<T>> take(int maxCount) {
          synchronized (this.contents) {
              Exceptions.checkNotClosed(this.closed, this);
              Preconditions.checkState(this.pendingTake == null, "Cannot have more than one concurrent pending take() request.");
              Queue<T> result = fetch(maxCount);
              if (result.size() > 0) {
                  return CompletableFuture.completedFuture(result);
              } else {
                  this.pendingTake = new CompletableFuture<>();
                  return this.pendingTake;
              }
          }
      }
docs: Returns the next items from the queue. If the queue is empty, it blocks the call until at least one item is added.
  
  @param maxCount The maximum number of items to return. This argument will be ignored if the queue is currently empty,
  but in that case the result will always be completed with exactly one element.
  @return A CompletableFuture that, when completed, will contain the requested result. If the queue is not currently
  empty, this Future will already be completed, otherwise it will be completed the next time the add() method is called.
  If the queue is closed and this Future is not yet completed, it will be cancelled.
  @throws ObjectClosedException If the Queue is closed.
  @throws IllegalStateException If another call to take() is in progress.