FELIX-5155: Do not invoke update callback in case the component implementation is an internal adapter object.
We don't invoke the callback in such a case, because if the update callback has been declared with an external
callback instance object, then calling the callback now would end up in a double update callback invocation: 
The update callback instance would be called a first time by the configuration dependency added to the internal adapter object,
and it would then be called a second time by the same configuration
dependency copied from the internal adapter component into the actual component instance created by the adapter.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1730313 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java b/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
index d129e42..ee917ce 100644
--- a/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
@@ -381,6 +381,18 @@
 
     private void invokeUpdated(Dictionary<?, ?> settings) throws ConfigurationException {
         if (m_updateInvokedCache.compareAndSet(false, true)) {
+            
+            // FELIX-5155: if component impl is an internal DM adapter, we must not invoke the callback on it
+            // because in case there is an external callback instance specified for the configuration callback,
+            // then we don't want to invoke it now. The external callback instance will be invoked
+            // on the other actual configuration dependency copied into the actual component instance created by the
+            // adapter.
+            
+            Object mainComponentInstance = m_component.getInstances();
+            if (mainComponentInstance instanceof AbstractDecorator) {
+                return;
+            }
+            
             Object[] instances = super.getInstances(); // either the callback instance or the component instances
             if (instances == null) {
                 return;