activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r833402 - in /activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker: BrokerService.java jmx/BrokerView.java jmx/ManagementContext.java
Date Fri, 06 Nov 2009 14:09:14 GMT
Author: dejanb
Date: Fri Nov  6 14:09:13 2009
New Revision: 833402

URL: http://svn.apache.org/viewvc?rev=833402&view=rev
Log:
merging 833395: https://issues.apache.org/activemq/browse/AMQ-2306 - jmx for slave brokers

Modified:
    activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
    activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=833402&r1=833401&r2=833402&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Fri Nov  6 14:09:13 2009
@@ -440,6 +440,9 @@
                 });
             }
             processHelperProperties();
+            if (isUseJmx()) {
+            	startManagementContext();
+            }
             getPersistenceAdapter().setUsageManager(getProducerSystemUsage());
             getPersistenceAdapter().setBrokerName(getBrokerName());
             LOG.info("Using Persistence Adapter: " + getPersistenceAdapter());
@@ -451,12 +454,15 @@
             addShutdownHook();
             getBroker().start();
             if (isUseJmx()) {
-                getManagementContext().start();
+            	if (!getManagementContext().isConnectorStarted()) {
+            		// try to restart management context
+            		// typical for slaves that use the same ports as master
+            		managementContext.stop();
+            		startManagementContext();
+            	}
                 ManagedRegionBroker managedBroker = (ManagedRegionBroker) regionBroker;
                 managedBroker.setContextBroker(broker);
-                adminView = new BrokerView(this, managedBroker);
-                ObjectName objectName = getBrokerObjectName();
-                AnnotatedMBean.registerMBean(getManagementContext(), adminView, objectName);
+            	adminView.setBroker(managedBroker);
             }
             BrokerRegistry.getInstance().bind(getBrokerName(), this);
             // see if there is a MasterBroker service and if so, configure
@@ -1895,6 +1901,13 @@
     protected void slaveConnectionEstablished() {
         slaveStartSignal.countDown();
     }
+    
+    protected void startManagementContext() throws Exception {
+        getManagementContext().start();
+        adminView = new BrokerView(this, null);
+        ObjectName objectName = getBrokerObjectName();
+        AnnotatedMBean.registerMBean(getManagementContext(), adminView, objectName);
+    }
 
     /**
      * Start all transport and network connections, proxies and bridges

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java?rev=833402&r1=833401&r2=833402&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
(original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
Fri Nov  6 14:09:13 2009
@@ -43,7 +43,7 @@
  */
 public class BrokerView implements BrokerViewMBean {
 
-    final ManagedRegionBroker broker;
+    ManagedRegionBroker broker;
     private final BrokerService brokerService;
     private final AtomicInteger sessionIdCounter = new AtomicInteger(0);
 
@@ -56,6 +56,10 @@
         return broker;
     }
 
+    public void setBroker(ManagedRegionBroker broker) {
+        this.broker = broker;
+    }
+    
     public String getBrokerId() {
         return broker.getBrokerId().toString();
     }

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java?rev=833402&r1=833401&r2=833402&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
(original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
Fri Nov  6 14:09:13 2009
@@ -212,7 +212,11 @@
         return findTigerMbeanServer;
     }
 
-    /**
+    public boolean isConnectorStarted() {
+		return connectorServer.isActive();
+	}
+
+	/**
      * Enables/disables the searching for the Java 5 platform MBeanServer
      */
     public void setFindTigerMbeanServer(boolean findTigerMbeanServer) {



Mime
View raw message