mcgilman commented on code in PR #10733:
URL: https://github.com/apache/nifi/pull/10733#discussion_r2666537389


##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java:
##########
@@ -530,16 +518,46 @@ public Resource getResource() {
            activeConfigurationContext,
            connectorStateTransition,
            flowContextFactory,
-           connectorValidationTrigger
+           connectorValidationTrigger,
+           false
        );
 
-       initializeDefaultValues(connector, 
connectorNode.getActiveFlowContext());
-       // TODO: If an Exception is thrown in the call to #initialize, we 
should create a Ghosted Connector
-       connectorNode.initializeConnector(initContext);
+       try {
+           initializeDefaultValues(connector, 
connectorNode.getActiveFlowContext());
+
+           final FrameworkConnectorInitializationContext initContext = 
createConnectorInitializationContext(managedProcessGroup, componentLog);
+           connectorNode.initializeConnector(initContext);
+       } catch (final Exception e) {
+           logger.error("Could not initialize Connector of type {} from {} for 
ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, 
identifier, e.getMessage(), e);

Review Comment:
   `createConnector` above will create a new instance classloader. If this 
catch block hits we fallback to the ghost connector. Assuming this is now 
orphaned should we be cleaning up the instance classloader here?
   
   `extensionManager.removeInstanceClassLoader(identifier);`



-- 
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: [email protected]

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

Reply via email to