jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java
changeset 1004 5ba8217eb504
parent 2 90ce3da70b43
child 1247 b4c26443dee5
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java	Thu Jul 31 14:20:11 2008 +0200
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java	Thu Jul 31 15:31:13 2008 +0200
@@ -35,7 +35,9 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
+import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
 import javax.management.*;
@@ -88,6 +90,7 @@
  * If the logic for adding the notification buffer's listener is incorrect
  * we could remove zero or two notifications from an MBean.
  */
+import javax.management.remote.rmi.RMIConnectorServer;
 public class NotificationBufferDeadlockTest {
     public static void main(String[] args) throws Exception {
         System.out.println("Check no deadlock if notif sent while initial " +
@@ -109,7 +112,13 @@
     }
 
     private static void test(String proto) throws Exception {
-        System.out.println("Testing protocol " + proto);
+        test(proto, false);
+        test(proto, true);
+    }
+
+    private static void test(String proto, boolean eventService) throws Exception {
+        System.out.println("Testing protocol " + proto + " with" +
+                (eventService ? "" : "out") + " event service");
         MBeanServer mbs = MBeanServerFactory.newMBeanServer();
         ObjectName testName = newName();
         DeadlockTest test = new DeadlockTest();
@@ -117,8 +126,11 @@
         JMXServiceURL url = new JMXServiceURL("service:jmx:" + proto + ":///");
         JMXConnectorServer cs;
         try {
+            Map<String, String> env = Collections.singletonMap(
+                    RMIConnectorServer.DELEGATE_TO_EVENT_SERVICE,
+                    Boolean.toString(eventService));
             cs =
-                JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
+                JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
         } catch (MalformedURLException e) {
             System.out.println("...protocol not supported, ignoring");
             return;