ottobackwards commented on a change in pull request #4852:
URL: https://github.com/apache/nifi/pull/4852#discussion_r584897118



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java
##########
@@ -402,6 +409,60 @@ private ControllerServiceNode 
createControllerServiceNode() throws ClassNotFound
         }
     }
 
+    private static void verifyControllerServiceReferences(final 
ConfigurableComponent component, final ClassLoader bundleClassLoader) throws 
InstantiationException {
+        // If a component lives in the same NAR as a Controller Service API, 
and the component references the Controller Service API (either
+        // by itself implementing the API or by having a Property Descriptor 
that identifies the Controller Service), then the component is not
+        // allowed to Require Instance Class Loading. This is done because 
when a component requires Instance Class Loading, the jars within the
+        // NAR and its parents must be copied to a new class loader all the 
way up to the point of the Controller Service APIs. If the Controller
+        // Service API lives in the same NAR as the implementation itself, 
then we cannot duplicate the NAR ClassLoader. Otherwise, we would have
+        // two different NAR ClassLoaders that each define the Service API. 
And the Service API class must live in the parent ClassLoader for both
+        // the referencing component AND the implementing component.
+
+        // if the extension does not require instance classloading, there is 
no concern.
+        final boolean requiresInstanceClassLoading = 
component.getClass().isAnnotationPresent(RequiresInstanceClassLoading.class);

Review comment:
       There are dragons here that should be logged




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to