FELIX-1278 applied the patch so the dependency remembers someone explicitly setting auto config.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@880645 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java b/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
index f4250cb..195fa12 100644
--- a/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
+++ b/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
@@ -60,6 +60,7 @@
private Object m_serviceInstance;
private final Logger m_logger;
private String m_autoConfigInstance;
+ private boolean m_autoConfigInvoked;
private Object m_defaultImplementation;
private Object m_defaultImplementationInstance;
@@ -596,6 +597,7 @@
public synchronized ServiceDependency setAutoConfig(boolean autoConfig) {
ensureNotActive();
m_autoConfig = autoConfig;
+ m_autoConfigInvoked = true;
return this;
}
@@ -611,6 +613,7 @@
ensureNotActive();
m_autoConfig = (instanceName != null);
m_autoConfigInstance = instanceName;
+ m_autoConfigInvoked = true;
return this;
}
@@ -672,8 +675,9 @@
*/
public synchronized ServiceDependency setCallbacks(Object instance, String added, String changed, String removed) {
ensureNotActive();
- // if at least one valid callback is specified, we turn off auto configuration
- if (added != null || removed != null || changed != null) {
+ // if at least one valid callback is specified, we turn off auto configuration, unless
+ // someone already explicitly invoked autoConfig
+ if ((added != null || removed != null || changed != null) && ! m_autoConfigInvoked) {
setAutoConfig(false);
}
m_callbackInstance = instance;