public void poll(List<E> returnList, int pollTimeoutMs) {
    E first = null;
    try {
      first = queue.poll(pollTimeoutMs, TimeUnit.MILLISECONDS);
    } catch (InterruptedException ie) {
      LOGGER.warn("Interrupted polling for responses in queue", ie);
    }
    if (first == null) {
      return;
    }
    // Filter out any wakeup markers that may be in the queue. These are only there to stop a timed poll early.
    FilteredInserter<E> filteredInserter =
        new BatchBlockingQueue.FilteredInserter<>(returnList, e -> e != wakeupMarker);
    filteredInserter.add(first);
    queue.drainTo(filteredInserter);
  }
Like {@link #poll(int)} but allows the caller to pass in their own list.
@param returnList the list to add items taken off the queue to.
@param pollTimeoutMs the poll timeout in milliseconds.
ambry-utils/src/main/java/com/github/ambry/utils/BatchBlockingQueue.java