X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fblueprint%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fblueprint%2Fext%2FComponentProcessor.java;h=84847a14b1687f87cc7b94bdb58fb4b4eff2f7be;hp=97f2fd2b0c92f8bbf59f15d900f8601fd17fc07e;hb=047e0a0a712e069ea59c503cbe757392d35974a5;hpb=0e0e2378d379e2fbc12d8f93ef41b3267e10f83a diff --git a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/ComponentProcessor.java b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/ComponentProcessor.java index 97f2fd2b0c..84847a14b1 100644 --- a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/ComponentProcessor.java +++ b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/ComponentProcessor.java @@ -12,6 +12,8 @@ import java.util.ArrayList; import java.util.Dictionary; import java.util.Hashtable; import java.util.List; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.aries.blueprint.ComponentDefinitionRegistry; import org.apache.aries.blueprint.ComponentDefinitionRegistryProcessor; import org.apache.aries.blueprint.ext.AbstractPropertyPlaceholder; @@ -133,7 +135,8 @@ public class ComponentProcessor implements ComponentDefinitionRegistryProcessor // Register a ManagedService so we get updates from the ConfigAdmin when the cfg file corresponding // to the persistentId changes. final ManagedService managedService = new ManagedService() { - private volatile boolean initialUpdate = true; + private final AtomicBoolean initialUpdate = new AtomicBoolean(true); + private volatile Dictionary previousProperties; @Override public void updated(final Dictionary properties) { @@ -143,11 +146,11 @@ public class ComponentProcessor implements ComponentDefinitionRegistryProcessor // The first update occurs when the service is registered so ignore it as we want subsequent // updates when it changes. The ConfigAdmin will send an update even if the cfg file doesn't // yet exist. - if (initialUpdate) { - initialUpdate = false; - } else { + if (!initialUpdate.compareAndSet(true, false) && !Objects.equals(previousProperties, properties)) { blueprintContainerRestartService.restartContainerAndDependents(bundle); } + + previousProperties = properties; } };