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


##########
src/main/java/org/apache/nifi/components/connector/components/ProcessGroupLifecycle.java:
##########
@@ -51,4 +51,20 @@ public interface ProcessGroupLifecycle {
     CompletableFuture<Void> stopStatelessGroups(ComponentHierarchyScope scope);
 
     int getActiveThreadCount();
+
+    /**
+     * Begins draining the Process Group, so that no new data is brought into 
the group while the data already queued in it is processed.
+     * The drain stays active until {@link #endDrain()} is called.
+     *
+     * @return a future that completes once the drain has begun, or completes 
exceptionally if the drain could not begin
+     */
+    default CompletableFuture<Void> beginDrain() {
+        throw new UnsupportedOperationException("Draining is not supported by 
" + getClass().getName());
+    }
+
+    /**
+     * Ends the active drain of the Process Group, if there is one. Ending a 
drain does not stop any components.
+     */
+    default void endDrain() {

Review Comment:
   Yes, the intent is very much that there can only ever be zero or one drain. 
If we have some group draining, it should reject a second request to drain. The 
framework should also reject a request to drain a parent group or a child 
group. If you wanted to drain at a higher level you'd need to cancel the drain 
or wait for it to complete, then start the drain at the higher level.



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