private static <T> void updateLeaseCount(LoadingCache<Class<T>, AtomicInteger> usageCounts,
    T codec, int delta) {
    if (codec != null && usageCounts != null) {
      Class<T> codecClass = ReflectionUtils.getClass(codec);
      usageCounts.getUnchecked(codecClass).addAndGet(delta);
    }
  }
Copied from hadoop-common without significant modification.
hbase-common/src/main/java/org/apache/hadoop/hbase/io/compress/CodecPool.java