activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r833376 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/jmx/ManagementContext.java test/java/org/apache/activemq/broker/ft/MasterSlaveSlaveDieTest.java test/resources/log4j.properties
Date Fri, 06 Nov 2009 12:26:34 GMT
Author: gtully
Date: Fri Nov  6 12:26:34 2009
New Revision: 833376

URL: http://svn.apache.org/viewvc?rev=833376&view=rev
Log:
soreuse addr on rmi connector and enable some debug logging to track down hudson jmx related
intermittent failures

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveSlaveDieTest.java
    activemq/trunk/activemq-core/src/test/resources/log4j.properties

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java?rev=833376&r1=833375&r2=833376&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
Fri Nov  6 12:26:34 2009
@@ -19,8 +19,10 @@
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
+import java.net.ServerSocket;
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
+import java.rmi.server.RMIServerSocketFactory;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
@@ -89,17 +91,20 @@
                 try {
                     getMBeanServer().invoke(namingServiceObjectName, "start", null, null);
                 } catch (Throwable ignore) {
+                    LOG.debug("ignored error on start invocation", ignore);
                 }
                 Thread t = new Thread("JMX connector") {
                     public void run() {
                         try {
                             JMXConnectorServer server = connectorServer;
                             if (started.get() && server != null) {
+                                LOG.debug("Starting JMX JMXConnectorServer...");
                                 server.start();
                                 LOG.info("JMX consoles can connect to " + server.getAddress());
                             }
                         } catch (IOException e) {
                             LOG.warn("Failed to start jmx connector: " + e.getMessage());
+                            LOG.debug("Reason for failed jms connector start", e);
                         }
                     }
                 };
@@ -403,9 +408,15 @@
     private void createConnector(MBeanServer mbeanServer) throws MalformedObjectNameException,
MalformedURLException, IOException {
         // Create the NamingService, needed by JSR 160
         try {
-        	if (registry == null) {
-        		registry = LocateRegistry.createRegistry(connectorPort);
-        	}
+            if (registry == null) {
+                registry = LocateRegistry.createRegistry(connectorPort, null, new RMIServerSocketFactory()
{
+                    public ServerSocket createServerSocket(int port)
+                            throws IOException {
+                        ServerSocket result = new ServerSocket(port);
+                        result.setReuseAddress(true);
+                        return result;
+                    }});
+            }
             namingServiceObjectName = ObjectName.getInstance("naming:type=rmiregistry");
             // Do not use the createMBean as the mx4j jar may not be in the
             // same class loader than the server

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveSlaveDieTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveSlaveDieTest.java?rev=833376&r1=833375&r2=833376&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveSlaveDieTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveSlaveDieTest.java
Fri Nov  6 12:26:34 2009
@@ -25,7 +25,6 @@
 import org.apache.activemq.broker.BrokerPlugin;
 import org.apache.activemq.broker.BrokerPluginSupport;
 import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.util.SocketProxy;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -89,5 +88,7 @@
         LOG.info("checking master still alive");
         assertTrue("master is still alive", master.isStarted());
         assertFalse("plugin was not yet stopped", pluginStopped.get());
+        master.stop();
+        master.waitUntilStopped();
     }
 }
\ No newline at end of file

Modified: activemq/trunk/activemq-core/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/log4j.properties?rev=833376&r1=833375&r2=833376&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/log4j.properties (original)
+++ activemq/trunk/activemq-core/src/test/resources/log4j.properties Fri Nov  6 12:26:34 2009
@@ -22,6 +22,9 @@
 
 #log4j.logger.org.apache.activemq=DEBUG
 
+# get to the bottom of jmx related intermittent failures
+log4j.logger.org.apache.activemq.broker.jmx.ManagementContext=DEBUG
+
 # CONSOLE appender not used by default
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout



Mime
View raw message