exceptionfactory commented on code in PR #8151:
URL: https://github.com/apache/nifi/pull/8151#discussion_r1425529797


##########
minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/MiNiFi.java:
##########
@@ -216,12 +221,43 @@ public void run() {
      * @param args things which are ignored
      */
     public static void main(String[] args) {
-        logger.info("Launching MiNiFi...");
+        LOGGER.info("Launching MiNiFi...");
         try {
-            NiFiProperties niFiProperties = 
MultiSourceMinifiProperties.getInstance();
-            new MiNiFi(niFiProperties);
+            NiFiProperties properties = getValidatedMiNifiProperties(args);
+            new MiNiFi(properties);
         } catch (final Throwable t) {
-            logger.error("Failure to launch MiNiFi due to " + t, t);
+            LOGGER.error("Failure to launch MiNiFi due to " + t, t);
+        }
+    }
+
+    protected static NiFiProperties getValidatedMiNifiProperties(String[] 
args) {
+        NiFiProperties properties = initializeProperties(args, 
createBootstrapClassLoader());
+        properties.validate();
+        return properties;
+    }
+
+    private static NiFiProperties initializeProperties(final String[] args, 
final ClassLoader boostrapLoader) {
+        ClassLoader contextClassLoader = 
Thread.currentThread().getContextClassLoader();
+        String key = getFormattedKey(args);
+
+        Thread.currentThread().setContextClassLoader(boostrapLoader);
+
+        try {
+            Class<?> propsLoaderClass = 
Class.forName("org.apache.nifi.minifi.properties.MiNiFiPropertiesLoader", true, 
boostrapLoader);
+            Method withKeyMethod = propsLoaderClass.getMethod("withKey", 
String.class);
+            Object loaderInstance = withKeyMethod.invoke(null, key);

Review Comment:
   Thanks for confirming, that's good to know.



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