exceptionfactory commented on code in PR #8158:
URL: https://github.com/apache/nifi/pull/8158#discussion_r1453623270
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java:
##########
@@ -6233,27 +6239,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 =
Collections.synchronizedList(new ArrayList<>());
+ final boolean analyticsEnabled =
Boolean.parseBoolean(properties.getProperty(NiFiProperties.ANALYTICS_PREDICTION_ENABLED,
Boolean.FALSE.toString()));
+
+ if (analyticsEnabled) {
+ if (parallelProcessingExecutor == null) {
+ parallelProcessingExecutor =
Executors.newVirtualThreadPerTaskExecutor();
+ }
Review Comment:
This conditional instantiation is not thread safe for multiple invocations
of the same method. The property needs to be checked earlier in the process.
--
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]