db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1138444 - /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Date Wed, 22 Jun 2011 12:58:54 GMT
Author: kahatlen
Date: Wed Jun 22 12:58:54 2011
New Revision: 1138444

URL: http://svn.apache.org/viewvc?rev=1138444&view=rev
Log:
DERBY-3689: 'PrivilegedActionException: javax.management.InstanceNotFoundException' in '*(VersionMBeanTest
/ NetworkServerMBeanTest)'

Register MBeans before starting the client thread so that the MBeans
can be accessed by the tests once they detect the network server is
up and running.

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java?rev=1138444&r1=1138443&r2=1138444&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
(original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Wed Jun 22 12:58:54 2011
@@ -768,7 +768,25 @@ public final class NetworkServerControlI
 				{Integer.toString(portNumber), att_srvclsnm, versionString});
 			break;
 		}
-		
+
+        // First, register any MBeans. We do this before we start accepting
+        // connections from the clients to ease testing of JMX (DERBY-3689).
+        // This way we know that once we can connect to the network server,
+        // the MBeans will be available.
+        ManagementService mgmtService = ((ManagementService)
+                Monitor.getSystemModule(Module.JMX));
+
+        final Object versionMBean = mgmtService.registerMBean(
+                           new Version(
+                                   getNetProductVersionHolder(),
+                                   SystemPermission.SERVER),
+                           VersionMBean.class,
+                           "type=Version,jar=derbynet.jar");
+        final Object networkServerMBean = mgmtService.registerMBean(
+                            new NetworkServerMBeanImpl(this),
+                            NetworkServerMBean.class,
+                            "type=NetworkServer");
+
 		// We accept clients on a separate thread so we don't run into a problem
 		// blocking on the accept when trying to process a shutdown
 		final ClientThread clientThread =	 
@@ -782,22 +800,7 @@ public final class NetworkServerControlI
 								}
 							);
 		clientThread.start();
-        
-        // Now that we are up and running, register any MBeans
-        ManagementService mgmtService = ((ManagementService)
-                Monitor.getSystemModule(Module.JMX));
-        
-        final Object versionMBean = mgmtService.registerMBean(
-                           new Version(
-                                   getNetProductVersionHolder(),
-                                   SystemPermission.SERVER),
-                           VersionMBean.class,
-                           "type=Version,jar=derbynet.jar");
-        final Object networkServerMBean = mgmtService.registerMBean(
-                            new NetworkServerMBeanImpl(this),
-                            NetworkServerMBean.class,
-                            "type=NetworkServer");
-                			
+
 		try {
 			// wait until we are told to shutdown or someone sends an InterruptedException
 	        synchronized(shutdownSync) {



Mime
View raw message