public Queue<T> poll(int maxCount) {
        synchronized (this.contents) {
            Exceptions.checkNotClosed(this.closed, this);
            Preconditions.checkState(this.pendingTake == null, "Cannot call poll() when there is a pending take() request.");
            return fetch(maxCount);
        }
    }
public Queue < T > poll ( int maxCount ) { synchronized ( this . contents ) { Exceptions . checkNotClosed ( this . closed , this ) ; Preconditions . checkState ( this . pendingTake == null , "Cannot call poll() when there is a pending take() request." ) ; return fetch ( maxCount ) ; } }
Returns the next items from the queue, if any.

@param maxCount The maximum number of items to return.
@return A Queue containing at most maxCount items, or empty if there is nothing in the queue.
@throws IllegalStateException If there is a pending take() operation which hasn't completed yet.