NIFI-10772 Clarify logs on shutdown where controller service and/or

processor were unable to properly start

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes #6829
This commit is contained in:
Nissim Shiman 2022-11-09 18:49:51 +00:00 committed by Matthew Burgess
parent 0d9dc6c540
commit fe25424233
No known key found for this signature in database
GPG Key ID: 05D3DEB8126DAD24
2 changed files with 17 additions and 3 deletions

View File

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

View File

@ -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;
}