private static <T> T borrow(Map<Class<T>, List<T>> pool,
      Class<? extends T> codecClass) {
    T codec = null;

    // Check if an appropriate codec is available
    synchronized (pool) {
      if (pool.containsKey(codecClass)) {
        List<T> codecList = pool.get(codecClass);

        if (codecList != null) {
          synchronized (codecList) {
            if (!codecList.isEmpty()) {
              codec = codecList.remove(codecList.size() - 1);
            }
          }
        }
      }
    }

    return codec;
  }
A global decompressor pool used to save the expensive
construction/destruction of (possibly native) decompression codecs.
ql/src/java/org/apache/hadoop/hive/ql/io/CodecPool.java