You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ha...@apache.org on 2011/08/18 11:44:25 UTC

svn commit: r1159115 - /geronimo/server/trunk/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java

Author: hanhongfang
Date: Thu Aug 18 09:44:25 2011
New Revision: 1159115

URL: http://svn.apache.org/viewvc?rev=1159115&view=rev
Log:
Change to monitor DefaultActiveMQBroker only. GERONIMO-6110 On 3.0 we don't register the 61616 port and the IP address for the server socket is not correct.

Modified:
    geronimo/server/trunk/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java

Modified: geronimo/server/trunk/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java?rev=1159115&r1=1159114&r2=1159115&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java (original)
+++ geronimo/server/trunk/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ActiveMQBrokerServiceMonitorGBean.java Thu Aug 18 09:44:25 2011
@@ -119,7 +119,13 @@ public class ActiveMQBrokerServiceMonito
     }
     
     protected void startConnectorWrapperGBeans(BrokerService brokerService) {
-        try {           
+        try {
+            // in case this brokerService has been processed
+            List<AbstractName> oldConnectorNames = brokerNameConnectorNamesMap.get(brokerService.getBrokerName());
+            if (oldConnectorNames!=null) {
+                return;
+            }
+            
             List<AbstractName> connectorNames = new ArrayList<AbstractName>();
             GBeanInfo gBeanInfo = new AnnotationGBeanInfoFactory().getGBeanInfo(ActiveMQTransportConnector.class);
             for (TransportConnector transportConnector : brokerService.getTransportConnectors()) {
@@ -130,12 +136,6 @@ public class ActiveMQBrokerServiceMonito
                 kernel.startGBean(connectorAbName);
                 connectorNames.add(connectorAbName);
             }
-            // in case this brokerService has been processed, remove the old connectorNames
-            List<AbstractName> oldConnectorNames = brokerNameConnectorNamesMap.remove(brokerService.getBrokerName());
-            if (oldConnectorNames!=null) {
-                stopConnectorWrapperGBeans(brokerService.getBrokerName());
-            }
-            // add new connectorsNames
             brokerNameConnectorNamesMap.put(brokerService.getBrokerName(), connectorNames);
         } catch (Exception e) {
         }
@@ -157,24 +157,18 @@ public class ActiveMQBrokerServiceMonito
     
     private Set<BrokerService> getBrokerService(Bundle bundle) {
         Set<BrokerService> brokerServices = new HashSet<BrokerService>();
+        String targetBundleSymbolicName = "org.apache.geronimo.configs.activemq-broker-blueprint";
  
-        try {        
-            String filter;
-            if (bundle == null) {
-                filter = null;
-            } else {
-                String symbolicName = bundle.getSymbolicName();
-                String version = bundle.getVersion().toString();
-                filter = "(&(osgi.blueprint.container.symbolicname=" + symbolicName
-                        + ")(osgi.blueprint.container.version=" + version + "))";
+        try {           
+            if (bundle!=null && !targetBundleSymbolicName.equals(bundle.getSymbolicName())) {
+                return brokerServices;
             }
-            
+            String filter = "(osgi.blueprint.container.symbolicname=" + targetBundleSymbolicName + ")";            
             String clazz = "org.osgi.service.blueprint.container.BlueprintContainer";            
             ServiceReference[] references = bundleContext.getServiceReferences(clazz, filter);
             if (references != null) {
                 for (ServiceReference reference: references) {
                     BlueprintContainer container = (BlueprintContainer) bundleContext.getService(reference);
-                    @SuppressWarnings("unchecked")
                     Set<String> ids = (Set<String>) container.getComponentIds();
                     for (Object id: ids) {
                         Object object = container.getComponentInstance((String)id);
@@ -183,7 +177,7 @@ public class ActiveMQBrokerServiceMonito
                         }
                     }
                 }
-            }            
+            }
         } catch (Exception e) {
             throw new RuntimeException(e);
         }