You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bb...@apache.org on 2019/06/12 14:56:36 UTC
[nifi] branch master updated: NIFI-6339: Only call
@OnConfigurationRestored method on components when they are created if
FlowController has been initialized
This is an automated email from the ASF dual-hosted git repository.
bbende pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push:
new 2465f67 NIFI-6339: Only call @OnConfigurationRestored method on components when they are created if FlowController has been initialized
2465f67 is described below
commit 2465f67dfe4132b3a52c14a7c0bb9cbdf21e507c
Author: Mark Payne <ma...@hotmail.com>
AuthorDate: Tue Jun 11 15:19:57 2019 -0400
NIFI-6339: Only call @OnConfigurationRestored method on components when they are created if FlowController has been initialized
This closes #3530.
Signed-off-by: Bryan Bende <bb...@apache.org>
---
.../apache/nifi/controller/flow/StandardFlowManager.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
index 0a31f11..9b326de 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
@@ -375,7 +375,7 @@ public class StandardFlowManager implements FlowManager {
throw new ComponentLifeCycleException("Failed to invoke @OnAdded methods of " + procNode.getProcessor(), e);
}
- if (firstTimeAdded) {
+ if (firstTimeAdded && flowController.isInitialized()) {
try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, procNode.getProcessor().getClass(), procNode.getProcessor().getIdentifier())) {
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, procNode.getProcessor());
}
@@ -544,7 +544,10 @@ public class StandardFlowManager implements FlowManager {
try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), taskClass, identifier)) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, taskNode.getReportingTask());
- ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, taskNode.getReportingTask());
+
+ if (flowController.isInitialized()) {
+ ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, taskNode.getReportingTask());
+ }
} catch (final Exception e) {
throw new ComponentLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + taskNode.getReportingTask(), e);
}
@@ -688,8 +691,10 @@ public class StandardFlowManager implements FlowManager {
if (firstTimeAdded) {
final ControllerService service = serviceNode.getControllerServiceImplementation();
- try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, service.getClass(), service.getIdentifier())) {
- ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, service);
+ if (flowController.isInitialized()) {
+ try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, service.getClass(), service.getIdentifier())) {
+ ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, service);
+ }
}
final ControllerService serviceImpl = serviceNode.getControllerServiceImplementation();