Enable dynamic reconfiguration of service dependencies (for primitive types).
Provide a method to invalidate the service object cache of a dependency.
Modify the wrong header of the temporal dependency handler NOTICE file.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@694291 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
index ce8a205..429f141 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
@@ -395,12 +395,32 @@
/**
* The dependency has been reconfigured.
- * @param departs : service no more matching.
+ * Call unbind method and then bind methods. If the dependency cache is not reset,
+ * the thread continues to get older services.
+ * @param departs : no more matching services.
* @param arrivals : new services
* @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[], org.osgi.framework.ServiceReference[])
*/
public void onDependencyReconfiguration(ServiceReference[] departs, ServiceReference[] arrivals) {
- throw new UnsupportedOperationException("Dependency set change is not yet supported");
+ for (int i = 0; departs != null && i < departs.length; i++) {
+ callUnbindMethod(departs[i]);
+ }
+
+ for (int i = 0; arrivals != null && i < arrivals.length; i++) {
+ callBindMethod(arrivals[i]);
+ }
+ }
+
+ /**
+ * Reset the thread local cache if used.
+ */
+ public void resetLocalCache() {
+ if (m_usage != null) {
+ Usage usage = (Usage) m_usage.get();
+ if (usage.m_stack > 0) {
+ createServiceObject(usage);
+ }
+ }
}
/**
diff --git a/ipojo/handler/temporal/NOTICE b/ipojo/handler/temporal/NOTICE
index 4dcec0b..a10772b 100644
--- a/ipojo/handler/temporal/NOTICE
+++ b/ipojo/handler/temporal/NOTICE
@@ -1,4 +1,4 @@
-Apache Felix iPOJO White-board Pattern Handler
+Apache Felix iPOJO Temporal Dependency Handler
Copyright 2008 The Apache Software Foundation
I. Included Software