You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "ivakegg (via GitHub)" <gi...@apache.org> on 2023/05/23 14:41:58 UTC

[GitHub] [accumulo] ivakegg commented on a diff in pull request #3400: fixes #3399: Access to configuration in context class loader factory

ivakegg commented on code in PR #3400:
URL: https://github.com/apache/accumulo/pull/3400#discussion_r1202461781


##########
core/src/main/java/org/apache/accumulo/core/classloader/ClassLoaderUtil.java:
##########
@@ -36,25 +39,30 @@ private ClassLoaderUtil() {
   /**
    * Initialize the ContextClassLoaderFactory
    */
-  public static synchronized void initContextFactory(AccumuloConfiguration conf) {
+  public static synchronized void initContextFactory(final AccumuloConfiguration conf) {
     if (FACTORY == null) {
       LOG.debug("Creating {}", ContextClassLoaderFactory.class.getName());
       String factoryName = conf.get(Property.GENERAL_CONTEXT_CLASSLOADER_FACTORY);
       if (factoryName == null || factoryName.isEmpty()) {
-        // load the default implementation
         LOG.info("Using default {}, which is subject to change in a future release",
             ContextClassLoaderFactory.class.getName());
-        FACTORY = new DefaultContextClassLoaderFactory(conf);
-      } else {
-        // load user's selected implementation
-        try {
-          var factoryClass = Class.forName(factoryName).asSubclass(ContextClassLoaderFactory.class);
-          LOG.info("Creating {}: {}", ContextClassLoaderFactory.class.getName(), factoryName);
-          FACTORY = factoryClass.getDeclaredConstructor().newInstance();
-        } catch (ReflectiveOperationException e) {
-          throw new IllegalStateException("Unable to load and initialize class: " + factoryName, e);
-        }
+        factoryName = DefaultContextClassLoaderFactory.class.getName();

Review Comment:
   hmm... ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org