mirror of https://github.com/apache/nifi.git
NIFI-1697 Ensuring FlowController appropriately wraps code with NarCloseable. This closes #312
This commit is contained in:
parent
65b26e6f41
commit
65b5c1a5f1
|
@ -3220,13 +3220,19 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R
|
||||||
final PrimaryNodeState nodeState = primary ? PrimaryNodeState.ELECTED_PRIMARY_NODE : PrimaryNodeState.PRIMARY_NODE_REVOKED;
|
final PrimaryNodeState nodeState = primary ? PrimaryNodeState.ELECTED_PRIMARY_NODE : PrimaryNodeState.PRIMARY_NODE_REVOKED;
|
||||||
final ProcessGroup rootGroup = getGroup(getRootGroupId());
|
final ProcessGroup rootGroup = getGroup(getRootGroupId());
|
||||||
for (final ProcessorNode procNode : rootGroup.findAllProcessors()) {
|
for (final ProcessorNode procNode : rootGroup.findAllProcessors()) {
|
||||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, procNode.getProcessor(), nodeState);
|
try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||||
|
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, procNode.getProcessor(), nodeState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (final ControllerServiceNode serviceNode : getAllControllerServices()) {
|
for (final ControllerServiceNode serviceNode : getAllControllerServices()) {
|
||||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, serviceNode.getControllerServiceImplementation(), nodeState);
|
try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||||
|
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, serviceNode.getControllerServiceImplementation(), nodeState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (final ReportingTaskNode reportingTaskNode : getAllReportingTasks()) {
|
for (final ReportingTaskNode reportingTaskNode : getAllReportingTasks()) {
|
||||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, reportingTaskNode.getReportingTask(), nodeState);
|
try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||||
|
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnPrimaryNodeStateChange.class, reportingTaskNode.getReportingTask(), nodeState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update primary
|
// update primary
|
||||||
|
|
|
@ -908,7 +908,9 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
|
||||||
getAnnotationData());
|
getAnnotationData());
|
||||||
|
|
||||||
final Collection<ValidationResult> validationResults;
|
final Collection<ValidationResult> validationResults;
|
||||||
validationResults = getProcessor().validate(validationContext);
|
try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||||
|
validationResults = getProcessor().validate(validationContext);
|
||||||
|
}
|
||||||
|
|
||||||
for (final ValidationResult result : validationResults) {
|
for (final ValidationResult result : validationResults) {
|
||||||
if (!result.isValid()) {
|
if (!result.isValid()) {
|
||||||
|
|
Loading…
Reference in New Issue