You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Andrei Lopukhov (Jira)" <ji...@apache.org> on 2021/06/18 10:02:00 UTC

[jira] [Created] (HBASE-26014) ServiceLoader usages are tied to Thread Context Classloader

Andrei Lopukhov created HBASE-26014:
---------------------------------------

             Summary: ServiceLoader usages are tied to Thread Context Classloader
                 Key: HBASE-26014
                 URL: https://issues.apache.org/jira/browse/HBASE-26014
             Project: HBase
          Issue Type: Improvement
            Reporter: Andrei Lopukhov


Classes which uses ServiceLoader facility does not specify ClassLoader to use.

For hbase-client 2.4.1 they are (at least):
 * SaslClientAuthenticationProviders
 * MetricRegistries

When hbase libraries are loaded dynamically and Thread Context Classloader is not set SaslClientAuthenticationProviders instantiation failes becuse it can't find default providers.

Some proposals for classloader selection strategy (usage dependent I guess):
 * Use classloader specified in Configuration instance.
 * Use classloader which loaded specific hbase class
 * Combine them: use classloader from Configuration if present and fallback to classloader which loaded specific hbase class

Real world example: currently we migrating from hbase 1 to hbase 2. For better compatibility and smooth migration we try to build abstraction around hbase client libraries and isolate them with custom classloaders. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)