tpalfy commented on a change in pull request #4798:
URL: https://github.com/apache/nifi/pull/4798#discussion_r578700170



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
##########
@@ -352,6 +352,47 @@ public void onTaskComplete() {
         return future;
     }
 
+    /**
+     * Runs the given {@link Processor} once by invoking its
+     * {@link ProcessorNode#runOnce(ScheduledExecutorService, long, long, 
Supplier, SchedulingAgentCallback)}
+     * method.
+     *
+     * @see ProcessorNode#runOnce(ScheduledExecutorService, long, long, 
Supplier, SchedulingAgentCallback)
+     */
+    @Override
+    public Future<Void> runProcessorOnce(ProcessorNode procNode, final 
Callable<Future<Void>> stopCallback) {
+        final LifecycleState lifecycleState = 
getLifecycleState(requireNonNull(procNode), true);
+
+        final Supplier<ProcessContext> processContextFactory = () -> new 
StandardProcessContext(procNode, getControllerServiceProvider(),
+            this.encryptor, getStateManager(procNode.getIdentifier()), 
lifecycleState::isTerminated, flowController);
+
+        final CompletableFuture<Void> future = new CompletableFuture<>();

Review comment:
       Those three statements each return an object that are required later. So 
the extracted method would need to have 3 return values. And since they don't 
really have anything to do with each other, it wouldn't make sense to create a 
DTO for these arbitrary three types.
   Also most of the logic is already extracted into the methods they invoke. 
These statements themselves contain little to no logic.
   I think it's fine to leave them as they are.




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