Author: pderop
Date: Sun Feb 14 11:02:59 2016
New Revision: 1730313
URL: http://svn.apache.org/viewvc?rev=1730313&view=rev
Log:
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.
Modified:
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
Modified:
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java?rev=1730313&r1=1730312&r2=1730313&view=diff
==============================================================================
---
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
(original)
+++
felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ConfigurationDependencyImpl.java
Sun Feb 14 11:02:59 2016
@@ -381,6 +381,18 @@ public class ConfigurationDependencyImpl
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;