changeset 44908:ff2246213f7b

8130084: javax/management/MBeanServer/NotifDeadlockTest.java timed out Summary: Changed 2 seconds timeout for deadlock to JTREG default timeout Reviewed-by: dholmes, dfuchs Contributed-by: ujwal.vangapally@oracle.com
author uvangapally
date Tue, 25 Apr 2017 12:22:48 +0530
parents 1407b19a2ddf
children 238b6aff1b9c
files jdk/test/javax/management/MBeanServer/NotifDeadlockTest.java
diffstat 1 files changed, 3 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/javax/management/MBeanServer/NotifDeadlockTest.java	Wed Jul 05 23:16:59 2017 +0200
+++ b/jdk/test/javax/management/MBeanServer/NotifDeadlockTest.java	Tue Apr 25 12:22:48 2017 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,6 @@
         }
     }
     static MBeanServer mbs;
-    static boolean timedOut;
 
     /* This listener registers or unregisters the MBean called on2
        when triggered.  */
@@ -110,83 +109,48 @@
                 };
                 t.start();
                 try {
-                    t.join(2000);
+                    t.join();
                 } catch (InterruptedException e) {
                     e.printStackTrace(); // should not happen
                 }
-                if (t.isAlive()) {
-                    System.out.println("FAILURE: Wait timed out: " +
-                                       "probable deadlock");
-                    timedOut = true;
-                }
             }
         }
     }
 
     public static void main(String[] args) throws Exception {
-        boolean success = true;
 
         System.out.println("Test 1: in register notif, unregister an MBean");
-        timedOut = false;
         mbs = MBeanServerFactory.createMBeanServer();
         mbs.createMBean("javax.management.timer.Timer", on2);
         mbs.addNotificationListener(delName, new XListener(false), null, null);
         mbs.createMBean("javax.management.timer.Timer", on1);
         MBeanServerFactory.releaseMBeanServer(mbs);
-        if (timedOut) {
-            success = false;
-            Thread.sleep(500);
-            // wait for the spawned thread to complete its work, probably
-        }
         System.out.println("Test 1 completed");
 
         System.out.println("Test 2: in unregister notif, unregister an MBean");
-        timedOut = false;
         mbs = MBeanServerFactory.createMBeanServer();
         mbs.createMBean("javax.management.timer.Timer", on1);
         mbs.createMBean("javax.management.timer.Timer", on2);
         mbs.addNotificationListener(delName, new XListener(false), null, null);
         mbs.unregisterMBean(on1);
         MBeanServerFactory.releaseMBeanServer(mbs);
-        if (timedOut) {
-            success = false;
-            Thread.sleep(500);
-            // wait for the spawned thread to complete its work, probably
-        }
         System.out.println("Test 2 completed");
 
         System.out.println("Test 3: in register notif, register an MBean");
-        timedOut = false;
         mbs = MBeanServerFactory.createMBeanServer();
         mbs.addNotificationListener(delName, new XListener(true), null, null);
         mbs.createMBean("javax.management.timer.Timer", on1);
         MBeanServerFactory.releaseMBeanServer(mbs);
-        if (timedOut) {
-            success = false;
-            Thread.sleep(500);
-            // wait for the spawned thread to complete its work, probably
-        }
         System.out.println("Test 3 completed");
 
         System.out.println("Test 4: in unregister notif, register an MBean");
-        timedOut = false;
         mbs = MBeanServerFactory.createMBeanServer();
         mbs.createMBean("javax.management.timer.Timer", on1);
         mbs.addNotificationListener(delName, new XListener(true), null, null);
         mbs.unregisterMBean(on1);
         MBeanServerFactory.releaseMBeanServer(mbs);
-        if (timedOut) {
-            success = false;
-            Thread.sleep(500);
-            // wait for the spawned thread to complete its work, probably
-        }
         System.out.println("Test 4 completed");
 
-        if (success)
-            System.out.println("Test passed");
-        else {
-            System.out.println("TEST FAILED: at least one subcase failed");
-            System.exit(1);
-        }
+        System.out.println("Test passed");
     }
 }