jackhalfalltrades commented on code in PR #307:
URL: https://github.com/apache/atlas/pull/307#discussion_r2066778483


##########
webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java:
##########
@@ -492,8 +542,30 @@ private void startConsumers(ExecutorService 
executorService) {
 
             HookConsumer hookConsumer = new HookConsumer(hookConsumerName, 
consumer);
 
-            consumers.add(hookConsumer);
-            executors.submit(hookConsumer);
+            hookConsumers.add(hookConsumer);
+        }
+        startConsumers(executorService, hookConsumers);
+    }
+
+    private void startConsumers(ExecutorService executorService, 
List<HookConsumer> hookConsumers) {
+        if (consumers == null) {
+            consumers = new ArrayList<>();
+        }
+
+        if (executorService == null) {
+            executorService = new ThreadPoolExecutor(
+                    0, // Core pool size
+                    Integer.MAX_VALUE, // Maximum pool size (dynamic scaling)
+                    60L, TimeUnit.SECONDS, // Idle thread timeout
+                    new SynchronousQueue<>(), // Direct handoff queue
+                    new ThreadFactoryBuilder().setNameFormat(THREADNAME_PREFIX 
+ " thread-%d").build());
+
+            executors = executorService;
+        }
+
+        for (final HookConsumer consumer : hookConsumers) {
+            consumers.add(consumer);
+            executors.submit(consumer);

Review Comment:
   During function call the executors are expected to have initialized or 
assigned with the value of executorService if executorService is not null. 
   If the executorService is not null that scenario is handled in 
startInternal.  
   
   
   



-- 
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: dev-unsubscr...@atlas.apache.org

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

Reply via email to