activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1057833 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java
Date Tue, 11 Jan 2011 20:16:18 GMT
Author: chirino
Date: Tue Jan 11 20:16:17 2011
New Revision: 1057833

URL: http://svn.apache.org/viewvc?rev=1057833&view=rev
Log:
Fixes AMQ-3130

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java?rev=1057833&r1=1057832&r2=1057833&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/osgi/Activator.java
Tue Jan 11 20:16:17 2011
@@ -26,6 +26,10 @@ import java.util.concurrent.ConcurrentHa
 import java.util.concurrent.ConcurrentMap;
 import java.net.URL;
 
+import org.apache.activemq.Service;
+import org.apache.activemq.store.PersistenceAdapter;
+import org.apache.activemq.transport.Transport;
+import org.apache.activemq.transport.discovery.DiscoveryAgent;
 import org.apache.activemq.util.FactoryFinder;
 import org.apache.activemq.util.FactoryFinder.ObjectFactory;
 import org.apache.commons.logging.LogFactory;
@@ -63,6 +67,7 @@ public class Activator implements Bundle
         debug("activating");
         this.bundleContext = bundleContext;
         debug("checking existing bundles");
+        bundleContext.addBundleListener(this);
         for (Bundle bundle : bundleContext.getBundles()) {
             if (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.STARTING
||
                 bundle.getState() == Bundle.ACTIVE || bundle.getState() == Bundle.STOPPING)
{
@@ -197,9 +202,15 @@ public class Activator implements Bundle
     }
 
     private boolean isImportingUs(Bundle bundle) {
+        return isImportingClass(bundle, Service.class)
+                || isImportingClass(bundle, Transport.class)
+                || isImportingClass(bundle, DiscoveryAgent.class)
+                || isImportingClass(bundle, PersistenceAdapter.class);
+    }
+
+    private boolean isImportingClass(Bundle bundle, Class clazz) {
         try {
-            // If that bundle can load our classes.. then it must be importing us.
-            return bundle.loadClass(Activator.class.getName())==Activator.class;
+            return bundle.loadClass(clazz.getName())==clazz;
         } catch (ClassNotFoundException e) {
             return false;
         }



Mime
View raw message