hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Enoch Hsu <e...@us.ibm.com>
Subject Compression ClassLoader
Date Thu, 22 May 2014 21:25:23 GMT

Hi All,

I was looking at Compression.java and I noticed that for Snappy and LZO
compression it is using ClassLoader.getSystemClassLoader() to retrieve the
class file.
LZ4 compression is using this built in function

 private static ClassLoader getClassLoaderForCodec() {
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    if (cl == null) {
      cl = Compression.class.getClassLoader();
    if (cl == null) {
      cl = ClassLoader.getSystemClassLoader();
    if (cl == null) {
      throw new RuntimeException("A ClassLoader to load the Codec could not
be determined");
    return cl;

Is there a reason for the differences between using getSystemClassLoader
and getClassLoaderForCodec?
Seems like the getClassLoaderForCodec method of retrieving compression
class files is more user friendly?

Enoch Hsu
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message