This is an automated email from the ASF dual-hosted git repository.
markap14 pushed a commit to branch NIFI-15258
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/NIFI-15258 by this push:
new 4dbf84d7b0 NIFI-15529: Fix to StatelessGroupLifecycle to ensure that
we set the desired state of Stateless Group Node before attempting to schedule;
updated StandardProcessScheduler.startStatelessGroup to make it more clear if
this is left out again at some point (#10832)
4dbf84d7b0 is described below
commit 4dbf84d7b0828546c6307d8df776ed2cd8cf6ea7
Author: Mark Payne <[email protected]>
AuthorDate: Thu Jan 29 16:56:43 2026 -0500
NIFI-15529: Fix to StatelessGroupLifecycle to ensure that we set the
desired state of Stateless Group Node before attempting to schedule; updated
StandardProcessScheduler.startStatelessGroup to make it more clear if this is
left out again at some point (#10832)
---
.../facades/standalone/StandaloneStatelessGroupLifecycle.java | 3 +++
.../nifi/controller/scheduling/StandardProcessScheduler.java | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/facades/standalone/StandaloneStatelessGroupLifecycle.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/facades/standalone/StandaloneStatelessGroupLifecycle.java
index 588644b149..f29287b323 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/facades/standalone/StandaloneStatelessGroupLifecycle.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/facades/standalone/StandaloneStatelessGroupLifecycle.java
@@ -19,6 +19,7 @@ package
org.apache.nifi.components.connector.facades.standalone;
import org.apache.nifi.components.connector.components.StatelessGroupLifecycle;
import org.apache.nifi.controller.ProcessScheduler;
+import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.groups.ProcessGroup;
import org.apache.nifi.groups.StatelessGroupNode;
@@ -35,11 +36,13 @@ public class StandaloneStatelessGroupLifecycle implements
StatelessGroupLifecycl
@Override
public CompletableFuture<Void> start() {
+ statelessGroupNode.setDesiredState(ScheduledState.RUNNING);
return processScheduler.startStatelessGroup(statelessGroupNode);
}
@Override
public CompletableFuture<Void> stop() {
+ statelessGroupNode.setDesiredState(ScheduledState.STOPPED);
return processScheduler.stopStatelessGroup(statelessGroupNode);
}
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
index 1b0f89a0db..de8c18ed6a 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
@@ -447,6 +447,12 @@ public final class StandardProcessScheduler implements
ProcessScheduler {
@Override
public synchronized CompletableFuture<Void> startStatelessGroup(final
StatelessGroupNode groupNode) {
+ final ScheduledState initialState = groupNode.getDesiredState();
+ if (initialState != ScheduledState.RUNNING) {
+ LOG.warn("{} scheduled to run but its desired state is {}, not
RUNNING; will not start the group", groupNode, initialState);
+ return CompletableFuture.failedFuture(new
IllegalStateException("Attempted to start %s but its desired state is %s, not
RUNNING".formatted(groupNode, initialState)));
+ }
+
final LifecycleState lifecycleState =
getLifecycleState(requireNonNull(groupNode), true, true);
lifecycleState.setScheduled(true);
@@ -515,7 +521,7 @@ public final class StandardProcessScheduler implements
ProcessScheduler {
}
}
- LOG.info("{} is no scheduled to run. Disabling {} Controller
Services", groupNode.getProcessGroup(), allServices.size());
+ LOG.info("{} is no longer scheduled to run. Disabling {}
Controller Services", groupNode.getProcessGroup(), allServices.size());
// Cancel all service start futures, interrupting them if they are
waiting
for (final Future<?> serviceStartFuture : serviceStartFutures) {