markap14 commented on a change in pull request #5042:
URL: https://github.com/apache/nifi/pull/5042#discussion_r626019376



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/flow/StandardStatelessFlow.java
##########
@@ -412,41 +419,130 @@ public TriggerResult getResult() throws 
InterruptedException {
             }
         };
 
-        final Future<?> future = runDataflowExecutor.submit(() -> 
executeDataflow(resultQueue, executionProgress));
+        final Future<?> future = runDataflowExecutor.submit(() -> 
executeDataflow(resultQueue, executionProgress, tracker));
         processFuture.set(future);
 
         return trigger;
     }
 
 
-    private void executeDataflow(final BlockingQueue<TriggerResult> 
resultQueue, final ExecutionProgress executionProgress) {
-        try {
-            for (final Connectable connectable : rootConnectables) {
-                final ProcessContext processContext = 
processContextFactory.createProcessContext(connectable);
-
-                final StatelessProcessSessionFactory sessionFactory = new 
StatelessProcessSessionFactory(connectable, repositoryContextFactory,
-                    processContextFactory, executionProgress);
+    private void executeDataflow(final BlockingQueue<TriggerResult> 
resultQueue, final ExecutionProgress executionProgress, final 
AsynchronousCommitTracker tracker) {
+        final long startNanos = System.nanoTime();
+        transactionThresholdMeter.reset();
 
-                final long start = System.nanoTime();
-                final long processingNanos;
+        try {
+            Connectable currentComponent = null;
 
-                // If there is no incoming connection, trigger once.
-                logger.debug("Triggering {}", connectable);
-                connectable.onTrigger(processContext, sessionFactory);
+            try {
+                boolean completionReached = false;
+                while (!completionReached) {

Review comment:
       It could. But the idea of a for-loop that isn't a counter blows my mind 
a bit :) I think that's very common in C/C++/many other languages. Just seems 
off in Java haha. I'll see what I can do here, though. I do agree that 4 levels 
of loops is probably not ideal. I did at one point try to refactor, though, and 
i broke something so i said nope, nevermind, undoing changes :)




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

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


Reply via email to