private static <T> int getLeaseCount(LoadingCache<Class<T>, AtomicInteger> usageCounts,
    Class<? extends T> codecClass) {
    return usageCounts.getUnchecked((Class<T>) codecClass).get();
  }
Copied from hadoop-common without significant modification.
hbase-common/src/main/java/org/apache/hadoop/hbase/io/compress/CodecPool.java