markap14 commented on code in PR #115:
URL: https://github.com/apache/nifi-api/pull/115#discussion_r4568209307


##########
src/main/java/org/apache/nifi/components/connector/AbstractConnector.java:
##########
@@ -202,9 +206,9 @@ public CompletableFuture<Void> drainFlowFiles(final 
FlowContext flowContext) {
             initialQueueSize.getObjectCount(), 
NumberFormat.getNumberInstance().format(initialQueueSize.getByteCount()));
 
         Thread.startVirtualThread(() -> {
+            final ProcessGroupLifecycle lifecycle = 
flowContext.getRootGroup().getLifecycle();
             try {
-                stopSourceComponents(flowContext).get();
-                startNonSourceComponents(result, flowContext);
+                lifecycle.beginDrain().get();

Review Comment:
   I don't think it makes sense to timeout. There is no way for the framework 
to know how long it should take and having the virtual thread blocked 
indefinitely doesn't really cost anything. Rather, it makes sense to allow the 
Connector to block on the returned `CompletableFuture` if it would like and 
then it's up to the caller to timeout if they'd like.



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

Reply via email to