felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r694291 - in /felix/trunk/ipojo: core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java handler/temporal/NOTICE
Date Thu, 11 Sep 2008 15:19:16 GMT
Author: clement
Date: Thu Sep 11 08:19:12 2008
New Revision: 694291

URL: http://svn.apache.org/viewvc?rev=694291&view=rev
Log:
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.

Modified:
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
    felix/trunk/ipojo/handler/temporal/NOTICE

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java?rev=694291&r1=694290&r2=694291&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
(original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
Thu Sep 11 08:19:12 2008
@@ -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);
+            }
+        }
     }
 
     /**

Modified: felix/trunk/ipojo/handler/temporal/NOTICE
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/temporal/NOTICE?rev=694291&r1=694290&r2=694291&view=diff
==============================================================================
--- felix/trunk/ipojo/handler/temporal/NOTICE (original)
+++ felix/trunk/ipojo/handler/temporal/NOTICE Thu Sep 11 08:19:12 2008
@@ -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



Mime
View raw message