incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r821565 - in /incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container: BlueprintEventDispatcher.java BlueprintExtender.java
Date Sun, 04 Oct 2009 17:38:54 GMT
Author: adc
Date: Sun Oct  4 17:38:54 2009
New Revision: 821565

URL: http://svn.apache.org/viewvc?rev=821565&view=rev
Log:
I thought that this bit of coupling was awkward

Modified:
    incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java
    incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java

Modified: incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java?rev=821565&r1=821564&r2=821565&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java
Sun Oct  4 17:38:54 2009
@@ -37,7 +37,9 @@
 
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
 import org.osgi.framework.ServiceReference;
+import org.osgi.framework.SynchronousBundleListener;
 import org.osgi.service.blueprint.container.BlueprintEvent;
 import org.osgi.service.blueprint.container.BlueprintListener;
 import org.osgi.service.blueprint.container.EventConstants;
@@ -56,7 +58,7 @@
  *
  * @version $Rev: 760378 $, $Date: 2009-03-31 11:31:38 +0200 (Tue, 31 Mar 2009) $
  */
-class BlueprintEventDispatcher implements BlueprintListener {
+class BlueprintEventDispatcher implements BlueprintListener, SynchronousBundleListener {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(BlueprintEventDispatcher.class);
 
@@ -70,6 +72,8 @@
 
         assert bundleContext != null;
 
+        bundleContext.addBundleListener(this);
+
         EventAdminListener listener = null;
         try {
             getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
@@ -197,10 +201,6 @@
         }
     }
 
-    void contextDestroyed(Bundle bundle) {
-        states.remove(bundle);
-    }
-
     void destroy() {
         executor.shutdown();
         // wait for the queued tasks to execute
@@ -216,6 +216,12 @@
         }
     }
 
+    public void bundleChanged(BundleEvent event) {
+        if (BundleEvent.STOPPING == event.getType()) {
+            states.remove(event.getBundle());
+        }
+    }
+
     private static class EventAdminListener implements BlueprintListener {
 
         private final ServiceTracker tracker;

Modified: incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java?rev=821565&r1=821564&r2=821565&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintExtender.java
Sun Oct  4 17:38:54 2009
@@ -169,7 +169,6 @@
         if (blueprintContainer != null) {
             LOGGER.debug("Destroying BlueprintContainer for bundle {}", bundle.getSymbolicName());
             blueprintContainer.destroy();
-            eventDispatcher.contextDestroyed(bundle);
         }
     }
     



Mime
View raw message