From 92062f9beb2690dceec5876ab48ea2af0bc877b7 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 14 Jan 2016 00:42:36 -0500 Subject: [PATCH] NIFI-1317: removed duplicate 'name' instance variable Reviewed by Tony Kurc (tkurc@apache.org). This closes #169 --- .../nifi/controller/AbstractConfiguredComponent.java | 3 ++- .../apache/nifi/controller/StandardProcessorNode.java | 9 +-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java index 978c612fbb..df93cc0838 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java @@ -45,7 +45,7 @@ public abstract class AbstractConfiguredComponent implements ConfigurableCompone private final ValidationContextFactory validationContextFactory; private final ControllerServiceProvider serviceProvider; - private final AtomicReference name = new AtomicReference<>(); + private final AtomicReference name; private final AtomicReference annotationData = new AtomicReference<>(); private final Lock lock = new ReentrantLock(); @@ -57,6 +57,7 @@ public abstract class AbstractConfiguredComponent implements ConfigurableCompone this.component = component; this.validationContextFactory = validationContextFactory; this.serviceProvider = serviceProvider; + this.name = new AtomicReference<>(component.getClass().getSimpleName()); } @Override diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java index 567c3c782c..aade16b343 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java @@ -93,7 +93,6 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable private final AtomicBoolean lossTolerant; private final AtomicReference scheduledState; private final AtomicReference comments; - private final AtomicReference name; private final AtomicReference position; private final AtomicReference annotationData; private final AtomicReference schedulingPeriod; // stored as string so it's presented to user as they entered it @@ -134,7 +133,6 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable final Set emptySetOfRelationships = new HashSet<>(); undefinedRelationshipsToTerminate = new AtomicReference<>(emptySetOfRelationships); comments = new AtomicReference<>(""); - name = new AtomicReference<>(processor.getClass().getSimpleName()); schedulingPeriod = new AtomicReference<>("0 sec"); schedulingNanos = new AtomicLong(MINIMUM_SCHEDULING_NANOS); yieldPeriod = new AtomicReference<>(DEFAULT_YIELD_PERIOD); @@ -344,11 +342,6 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable return Collections.unmodifiableSet(relationships); } - @Override - public String getName() { - return name.get(); - } - /** * @return the value of the processor's {@link CapabilityDescription} annotation, if one exists, else null. */ @@ -375,7 +368,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable if (isRunning()) { throw new IllegalStateException("Cannot modify Processor configuration while the Processor is running"); } - this.name.set(name); + super.setName(name); } finally { writeLock.unlock(); }