activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r888368 - /activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
Date Tue, 08 Dec 2009 12:27:09 GMT
Author: dejanb
Date: Tue Dec  8 12:27:08 2009
New Revision: 888368

URL: http://svn.apache.org/viewvc?rev=888368&view=rev
Log:
merging 888367 - https://issues.apache.org/activemq/browse/AMQ-2525 - Prevent broker deadlock
if jmxconnector start hangs

Modified:
    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/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=888368&r1=888367&r2=888368&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
Tue Dec  8 12:27:08 2009
@@ -68,6 +68,7 @@
     private int rmiServerPort;
     private String connectorPath = "/jmxrmi";
     private AtomicBoolean started = new AtomicBoolean(false);
+    private AtomicBoolean connectorStarting = new AtomicBoolean(false);
     private JMXConnectorServer connectorServer;
     private ObjectName namingServiceObjectName;
     private Registry registry;
@@ -95,7 +96,12 @@
                         try {
                             JMXConnectorServer server = connectorServer;
                             if (started.get() && server != null) {
-                                server.start();
+                                connectorStarting.set(true);
+                                try {
+                                	server.start();
+                                } finally {
+                                	connectorStarting.set(false);
+                                }
                                 LOG.info("JMX consoles can connect to " + server.getAddress());
                             }
                         } catch (IOException e) {
@@ -125,7 +131,9 @@
             connectorServer = null;
             if (server != null) {
                 try {
-                    server.stop();
+                	if (!connectorStarting.get()) {
+                		server.stop();
+                	}
                 } catch (IOException e) {
                     LOG.warn("Failed to stop jmx connector: " + e.getMessage());
                 }
@@ -213,7 +221,7 @@
     }
 
     public boolean isConnectorStarted() {
-		return connectorServer != null && connectorServer.isActive();
+		return connectorStarting.get() || (connectorServer != null && connectorServer.isActive());
 	}
 
 	/**



Mime
View raw message