This is an automated email from the ASF dual-hosted git repository.
mattyb149 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new fe25424233 NIFI-10772 Clarify logs on shutdown where controller
service and/or processor were unable to properly start
fe25424233 is described below
commit fe254242330c076fd1be522878b5b45fb7f5db63
Author: Nissim Shiman <[email protected]>
AuthorDate: Wed Nov 9 18:49:51 2022 +0000
NIFI-10772 Clarify logs on shutdown where controller service and/or
processor were unable to properly start
Signed-off-by: Matthew Burgess <[email protected]>
This closes #6829
---
.../org/apache/nifi/controller/StandardProcessorNode.java | 12 ++++++++++--
.../controller/service/StandardControllerServiceNode.java | 8 +++++++-
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
index 5556e5a279..81a858319e 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
@@ -105,6 +105,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -1799,8 +1800,15 @@ public class StandardProcessorNode extends ProcessorNode
implements Connectable
return null;
};
- // Trigger the task in a background thread.
- final Future<?> taskFuture =
schedulingAgentCallback.scheduleTask(startupTask);
+ final Future<?> taskFuture;
+ try {
+ // Trigger the task in a background thread.
+ taskFuture = schedulingAgentCallback.scheduleTask(startupTask);
+ } catch (RejectedExecutionException rejectedExecutionException) {
+ final ValidationState validationState = getValidationState();
+ LOG.error("Unable to start {}. Last known validation state was {}
: {}", this, validationState, validationState.getValidationErrors(),
rejectedExecutionException);
+ return;
+ }
// Trigger a task periodically to check if @OnScheduled task
completed. Once it has,
// this task will call SchedulingAgentCallback#onTaskComplete.
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
index fccfbf99fd..811fa9933c 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
@@ -76,6 +76,7 @@ import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -588,7 +589,12 @@ public class StandardControllerServiceNode extends
AbstractComponentNode impleme
LOG.debug("Cannot enable {} because it is not
currently valid. (Validation State is {}: {}). Will try again in 1 second",
StandardControllerServiceNode.this,
validationState, validationState.getValidationErrors());
- scheduler.schedule(this, 1, TimeUnit.SECONDS);
+ try {
+ scheduler.schedule(this, 1, TimeUnit.SECONDS);
+ } catch (RejectedExecutionException
rejectedExecutionException) {
+ LOG.error("Unable to enable {}. Last known
validation state was {} : {}", StandardControllerServiceNode.this,
validationState, validationState.getValidationErrors(),
+ rejectedExecutionException);
+ }
future.complete(null);
return;
}