FELIX-1213 Reactivate component with static reference if a new service
with higher ranking than a bound service is registered
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@783311 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java b/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java
index 031e6cb..90e90f3 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java
@@ -230,6 +230,21 @@
m_componentManager.reactivate();
}
+ else
+ {
+ // single service binding only which already exists
+ // we have to check whether the bound service is to be
+ // replaced
+ ServiceReference[] boundRefs = getBoundServiceReferences();
+ if ( isHigher( reference, boundRefs[0] ) )
+ {
+ m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Service "
+ + m_dependencyMetadata.getName() + " with higher ranking registered, reactivate component",
+ m_componentManager.getComponentMetadata(), null );
+
+ m_componentManager.reactivate();
+ }
+ }
}
// otherwise bind if we have a bind method and the service needs