code: private void emptyQueue() {
          if (queue == null) {
              return;
          }
          int startSize = cacheMap.size();
          while (true) {
              @SuppressWarnings("unchecked")
              CacheEntry<K,V> entry = (CacheEntry<K,V>)queue.poll();
              if (entry == null) {
                  break;
              }
              K key = entry.getKey();
              if (key == null) {
                  // key is null, entry has already been removed
                  continue;
              }
              CacheEntry<K,V> currentEntry = cacheMap.remove(key);
              // check if the entry in the map corresponds to the expired
              // entry. If not, readd the entry
              if ((currentEntry != null) && (entry != currentEntry)) {
                  cacheMap.put(key, currentEntry);
              }
          }
          if (DEBUG) {
              int endSize = cacheMap.size();
              if (startSize != endSize) {
                  System.out.println("*** Expunged " + (startSize - endSize)
                          + " entries, " + endSize + " entries left");
              }
          }
      }
docs: Empty the reference queue and remove all corresponding entries
  from the cache.
  
  This method should be called at the beginning of each public
  method.