jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java
changeset 1004 5ba8217eb504
parent 2 90ce3da70b43
child 1247 b4c26443dee5
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java	Thu Jul 31 14:20:11 2008 +0200
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIExitTest.java	Thu Jul 31 15:31:13 2008 +0200
@@ -35,6 +35,8 @@
 import java.net.MalformedURLException;
 import java.io.IOException;
 
+import java.util.Collections;
+import java.util.Map;
 import javax.management.MBeanServerFactory;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -47,12 +49,14 @@
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.rmi.RMIConnectorServer;
 
 /**
  * VM shutdown hook. Test that the hook is called less than 5 secs
  * after expected exit.
  */
 class TimeChecker extends Thread {
+    @Override
     public void run() {
         System.out.println("shutdown hook called");
         long elapsedTime =
@@ -81,12 +85,15 @@
     public static void main(String[] args) {
         System.out.println("Start test");
         Runtime.getRuntime().addShutdownHook(new TimeChecker());
-        test();
+        test(false);
+        test(true);
         exitStartTime = System.currentTimeMillis();
         System.out.println("End test");
     }
 
-    private static void test() {
+    private static void test(boolean eventService) {
+        System.out.println(
+                "---testing with" + (eventService ? "" : "out") + " Event Service");
         try {
             JMXServiceURL u = new JMXServiceURL("rmi", null, 0);
             JMXConnectorServer server;
@@ -105,8 +112,11 @@
                         }
                     };
 
+            Map<String, String> env = Collections.singletonMap(
+                    RMIConnectorServer.DELEGATE_TO_EVENT_SERVICE,
+                    Boolean.toString(eventService));
             server = JMXConnectorServerFactory.newJMXConnectorServer(u,
-                                                                     null,
+                                                                     env,
                                                                      mbs);
             server.start();