< prev index next >

test/java/util/logging/DrainFindDeadlockTest.java

Print this page




  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 import java.lang.management.ThreadInfo;
  24 import java.lang.management.ThreadMXBean;
  25 import java.lang.Thread.State;
  26 import java.io.IOException;
  27 import java.lang.management.ManagementFactory;
  28 import java.util.logging.LogManager;
  29 import java.util.logging.Logger;
  30 import java.util.Map;
  31 
  32 /**
  33  * @test
  34  * @bug 8010939
  35  * @summary check for deadlock between findLogger() and drainLoggerRefQueueBounded()
  36  * @author jim.gish@oracle.com
  37  * @build DrainFindDeadlockTest
  38  * @run main/othervm/timeout=10 DrainFindDeadlockTest

  39  */
  40 
  41 /**
  42  * This test is checking for a deadlock between
  43  * LogManager$LoggerContext.findLogger() and
  44  * LogManager.drainLoggerRefQueueBounded() (which could happen by calling
  45  * Logger.getLogger() and LogManager.readConfiguration() in different threads)
  46  */
  47 public class DrainFindDeadlockTest {
  48     private LogManager mgr = LogManager.getLogManager();
  49     private final static int MAX_ITERATIONS = 100;
  50 
  51     // Get a ThreadMXBean so we can check for deadlock.  N.B. this may
  52     // not be supported on all platforms, which means we will have to
  53     // resort to the traditional test timeout method. However, if
  54     // we have the support we'll get the deadlock details if one
  55     // is detected.
  56     private final static ThreadMXBean threadMXBean =
  57             ManagementFactory.getThreadMXBean();
  58     private final boolean threadMXBeanDeadlockSupported =




  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 import java.lang.management.ThreadInfo;
  24 import java.lang.management.ThreadMXBean;
  25 import java.lang.Thread.State;
  26 import java.io.IOException;
  27 import java.lang.management.ManagementFactory;
  28 import java.util.logging.LogManager;
  29 import java.util.logging.Logger;
  30 import java.util.Map;
  31 
  32 /**
  33  * @test
  34  * @bug 8010939
  35  * @summary check for deadlock between findLogger() and drainLoggerRefQueueBounded()
  36  * @author jim.gish@oracle.com
  37  * @build DrainFindDeadlockTest
  38  * @run main/othervm/timeout=10 DrainFindDeadlockTest
  39  * @key randomness
  40  */
  41 
  42 /**
  43  * This test is checking for a deadlock between
  44  * LogManager$LoggerContext.findLogger() and
  45  * LogManager.drainLoggerRefQueueBounded() (which could happen by calling
  46  * Logger.getLogger() and LogManager.readConfiguration() in different threads)
  47  */
  48 public class DrainFindDeadlockTest {
  49     private LogManager mgr = LogManager.getLogManager();
  50     private final static int MAX_ITERATIONS = 100;
  51 
  52     // Get a ThreadMXBean so we can check for deadlock.  N.B. this may
  53     // not be supported on all platforms, which means we will have to
  54     // resort to the traditional test timeout method. However, if
  55     // we have the support we'll get the deadlock details if one
  56     // is detected.
  57     private final static ThreadMXBean threadMXBean =
  58             ManagementFactory.getThreadMXBean();
  59     private final boolean threadMXBeanDeadlockSupported =


< prev index next >