static List<RAMQueueEntry> getRAMQueueEntries(BlockingQueue<RAMQueueEntry> q,
    List<RAMQueueEntry> receptacle) throws InterruptedException {
    // Clear sets all entries to null and sets size to 0. We retain allocations. Presume it
    // ok even if list grew to accommodate thousands.
    receptacle.clear();
    receptacle.add(q.take());
    q.drainTo(receptacle);
    return receptacle;
  }
Blocks until elements available in {@code q} then tries to grab as many as possible before
returning.
@param receptacle Where to stash the elements taken from queue. We clear before we use it just
                  in case.
@param q          The queue to take from.
@return {@code receptacle} laden with elements taken from the queue or empty if none found.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java