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


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java:
##########
@@ -6233,27 +6237,54 @@ protected Collection<AbstractMetricsRegistry> 
populateFlowMetrics() {
 
         // Get Connection Status Analytics (predictions, e.g.)
         Set<Connection> connections = 
controllerFacade.getFlowManager().findAllConnections();
-        for (Connection c : connections) {
-            // If a ResourceNotFoundException is thrown, analytics hasn't been 
enabled
+        Collection<Map<String, Long>> predictions = new 
ConcurrentLinkedDeque<>();
+
+        final boolean analyticsEnabled = 
Boolean.parseBoolean(properties.getProperty(NiFiProperties.ANALYTICS_PREDICTION_ENABLED,
 Boolean.FALSE.toString()));
+
+        if (analyticsEnabled) {
+            final int parallelProcessingThreads = 
properties.getIntegerProperty(NiFiProperties.ANALYTICS_PREDICTION_PARALLEL_PROCESSING_THREADS,
 4);
+            final long parallelProcessingTimeout = 
Math.round(FormatUtils.getPreciseTimeDuration(
+                    
properties.getProperty(NiFiProperties.ANALYTICS_PREDICTION_PARALLEL_PROCESSING_TIMEOUT,
 "1 min"), TimeUnit.MILLISECONDS));
+
+            final ForkJoinPool.ForkJoinWorkerThreadFactory factory = pool -> {

Review Comment:
   Creating Thread Pools is generally something that should happen at outside a 
particular method invocation so that threads can be reused. This may also be an 
opportunity to use virtual threads.



-- 
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: issues-unsubscr...@nifi.apache.org

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

Reply via email to