You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2017/09/14 14:46:31 UTC
nifi git commit: NIFI-3510: Added logging for when controller
services are enabled/disabled
Repository: nifi
Updated Branches:
refs/heads/master e01d59a46 -> 91383264d
NIFI-3510: Added logging for when controller services are enabled/disabled
Signed-off-by: Pierre Villard <pi...@gmail.com>
This closes #2151.
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/91383264
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/91383264
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/91383264
Branch: refs/heads/master
Commit: 91383264d853881d920f07b1e9c928dff2906c52
Parents: e01d59a
Author: m-hogue <ho...@gmail.com>
Authored: Tue Sep 12 16:30:02 2017 -0400
Committer: Pierre Villard <pi...@gmail.com>
Committed: Thu Sep 14 16:46:18 2017 +0200
----------------------------------------------------------------------
.../controller/service/StandardControllerServiceNode.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/91383264/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
index 216a996..f46f796 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
@@ -399,6 +399,7 @@ public class StandardControllerServiceNode extends AbstractConfiguredComponent i
this.active.set(true);
}
+ final StandardControllerServiceNode service = this;
final ConfigurationContext configContext = new StandardConfigurationContext(this, this.serviceProvider, null, getVariableRegistry());
scheduler.execute(new Runnable() {
@Override
@@ -408,17 +409,19 @@ public class StandardControllerServiceNode extends AbstractConfiguredComponent i
ReflectionUtils.invokeMethodsWithAnnotation(OnEnabled.class, getControllerServiceImplementation(), configContext);
}
- boolean shouldEnable = false;
+ boolean shouldEnable;
synchronized (active) {
shouldEnable = active.get() && stateTransition.enable();
}
if (!shouldEnable) {
- LOG.debug("Disabling service " + this + " after it has been enabled due to disable action being initiated.");
+ LOG.debug("Disabling service {} after it has been enabled due to disable action being initiated.", service);
// Can only happen if user initiated DISABLE operation before service finished enabling. It's state will be
// set to DISABLING (see disable() operation)
invokeDisable(configContext);
stateTransition.disable();
+ } else {
+ LOG.debug("Successfully enabled {}", service);
}
} catch (Exception e) {
future.completeExceptionally(e);
@@ -499,6 +502,7 @@ public class StandardControllerServiceNode extends AbstractConfiguredComponent i
private void invokeDisable(ConfigurationContext configContext) {
try (final NarCloseable nc = NarCloseable.withComponentNarLoader(getControllerServiceImplementation().getClass(), getIdentifier())) {
ReflectionUtils.invokeMethodsWithAnnotation(OnDisabled.class, StandardControllerServiceNode.this.getControllerServiceImplementation(), configContext);
+ LOG.debug("Successfully disabled {}", this);
} catch (Exception e) {
final Throwable cause = e instanceof InvocationTargetException ? e.getCause() : e;
final ComponentLog componentLog = new SimpleProcessLogger(getIdentifier(), StandardControllerServiceNode.this);