Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/930#discussion_r76246007
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java
---
@@ -34,8 +35,26 @@ public static NarCloseable withNarLoader() {
}
/**
- * Creates a Closeable object that can be used to to switch to current
class loader to the framework class loader
- * and will automatically set the ClassLoader back to the previous
class loader when closed
+ * Sets the current thread context class loader to the specific
appropriate
+ * Nar class loader for the given configurable component. Restores to
the
+ * previous classloader once complete. If the given class is not
assignable
+ * from ConfigurableComponent then the NarThreadContextClassLoader is
used.
+ *
+ * @param componentClass componentClass
+ * @return NarCloseable with current thread context classloader jailed
to
+ * the nar of the component
+ */
+ public static NarCloseable withComponentNarLoader(final Class
componentClass) {
+ final ClassLoader current =
Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(NarThreadContextClassLoader.getInstance());
--- End diff --
I think this line is superfluous - we are immediately overwriting the
context class loader in the next line.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---