Package java.lang.management

Examples of java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()


    return dump.toString();
  }
 
  static String buildDeadlockInfo() {
    ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
    long[] threadIds = threadBean.findMonitorDeadlockedThreads();
    if (threadIds != null && threadIds.length > 0) {
      StringWriter stringWriter = new StringWriter();
      PrintWriter out = new PrintWriter(stringWriter);
     
      ThreadInfo[] infos = threadBean.getThreadInfo(threadIds, true, true);
View Full Code Here


   * Checks if any threads are deadlocked. If any, print
   * the thread dump information.
   */
  public static boolean findDeadlock() {
     ThreadMXBean tmbean = ManagementFactory.getThreadMXBean();
     long[] tids = tmbean.findMonitorDeadlockedThreads();
     if (tids == null) {
         return false;
     } else {
        StringWriter str = new StringWriter();
        PrintWriter log = new PrintWriter(str);
View Full Code Here

        c1.get().write("start");

        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();

        while (!messageCount.await(100, TimeUnit.MILLISECONDS)) {
            long[] threads = threadMXBean.findMonitorDeadlockedThreads();

            if (null != threads) {
                StringBuffer sb = new StringBuffer(256);
                ThreadInfo[] infos = threadMXBean.getThreadInfo(threads, Integer.MAX_VALUE);
View Full Code Here

        if(deadlocks != null && deadlocks.length > 0) {
            sb.append("deadlocked threads:\n");
            _printThreads(bean,deadlocks,sb);
        }

        deadlocks=bean.findMonitorDeadlockedThreads();
        if(deadlocks != null && deadlocks.length > 0) {
            sb.append("monitor deadlocked threads:\n");
            _printThreads(bean,deadlocks,sb);
        }
        return sb.toString();
View Full Code Here

    nl.add( "daemon", tmbean.getDaemonThreadCount() );
    system.add( "threadCount", nl );
   
    // Deadlocks
    ThreadInfo[] tinfos;
    long[] tids = tmbean.findMonitorDeadlockedThreads();
    if (tids != null) {
      tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
      NamedList<SimpleOrderedMap<Object>> lst = new NamedList<SimpleOrderedMap<Object>>();
      for (ThreadInfo ti : tinfos) {
        lst.add( "thread", getThreadInfo( ti, tmbean ) );
View Full Code Here

        writer.append(tid).append(" ");
      }
      writer.append("\n");
    }

    long[] deadLockMonitorTids = threadMXBean
        .findMonitorDeadlockedThreads();
    if (deadLockMonitorTids != null) {
      writer.append(threadIds.length + " deadlocked monitor threads:");
      for (long tid : deadLockMonitorTids) {
        writer.append(tid).append(" ");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.