Java Code Examples for java.lang.management.MonitorInfo

The following are top voted examples for showing how to use java.lang.management.MonitorInfo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: incubator-netbeans   File: NbTestCase.java   Source Code and License 6 votes vote down vote up
private static StringBuilder printThreadInfo(ThreadInfo ti, StringBuilder sb) {
    // print thread information
    printThread(ti, sb);

    // print stack trace with locks
    StackTraceElement[] stacktrace = ti.getStackTrace();
    MonitorInfo[] monitors = ti.getLockedMonitors();
    for (int i = 0; i < stacktrace.length; i++) {
        StackTraceElement ste = stacktrace[i];
        sb.append("\t at " + ste.toString()).append("\n");
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == i) {
                sb.append("\t  - locked " + mi).append("\n");
            }
        }
    }
    sb.append("\n");
    return sb;
}
 
Example 2
Project: incubator-netbeans   File: Detector.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti, PrintStream out) {
   printThread(ti, out);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       out.println(INDENT + "at " + ste.toString()); // NOI18N
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               out.println(INDENT + "  - locked " + mi); // NOI18N
           }
       }
   }
   out.println();
}
 
Example 3
Project: hadoop-oss   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 4
Project: OpenJSharp   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 5
Project: hadoop   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 6
Project: jdk8u-jdk   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 7
Project: openjdk-jdk10   File: GraalOSRLockTest.java   Source Code and License 6 votes vote down vote up
public static boolean isMonitorLockHeldByThread(Object o, Thread t) {
    int oihc = System.identityHashCode(o);
    ThreadMXBean tmxbean = ManagementFactory.getThreadMXBean();
    ThreadInfo[] tinfos = tmxbean.dumpAllThreads(true, false);

    for (ThreadInfo ti : tinfos) {
        if (!(t != null && t.getId() != ti.getThreadId())) {
            for (MonitorInfo mi : ti.getLockedMonitors()) {
                if (mi.getIdentityHashCode() == oihc) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example 8
Project: ditb   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 9
Project: openjdk9   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 10
Project: ThriftyPaxos   File: AbbaLockingDetector.java   Source Code and License 6 votes vote down vote up
/**
 * We cannot simply call getLockedMonitors because it is not guaranteed to
 * return the locks in the correct order.
 */
private static void generateOrdering(final List<String> lockOrder,
        ThreadInfo info) {
    final MonitorInfo[] lockedMonitors = info.getLockedMonitors();
    Arrays.sort(lockedMonitors, new Comparator<MonitorInfo>() {
        @Override
        public int compare(MonitorInfo a, MonitorInfo b) {
            return b.getLockedStackDepth() - a.getLockedStackDepth();
        }
    });
    for (MonitorInfo mi : lockedMonitors) {
        String lockName = getObjectName(mi);
        if (lockName.equals("sun.misc.Launcher$AppClassLoader")) {
            // ignore, it shows up everywhere
            continue;
        }
        // Ignore locks which are locked multiple times in
        // succession - Java locks are recursive.
        if (!lockOrder.contains(lockName)) {
            lockOrder.add(lockName);
        }
    }
}
 
Example 11
Project: aliyun-oss-hadoop-fs   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 12
Project: graal-core   File: GraalOSRLockTest.java   Source Code and License 6 votes vote down vote up
public static boolean isMonitorLockHeldByThread(Object o, Thread t) {
    int oihc = System.identityHashCode(o);
    ThreadMXBean tmxbean = ManagementFactory.getThreadMXBean();
    ThreadInfo[] tinfos = tmxbean.dumpAllThreads(true, false);

    for (ThreadInfo ti : tinfos) {
        if (!(t != null && t.getId() != ti.getThreadId())) {
            for (MonitorInfo mi : ti.getLockedMonitors()) {
                if (mi.getIdentityHashCode() == oihc) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example 13
Project: big-c   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 14
Project: jdk8u_jdk   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 15
Project: lookaside_java-1.8.0-openjdk   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 16
Project: tda   File: MBeanDumper.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti, StringBuilder dump) {
   // print thread information
   printThread(ti, dump);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       dump.append(INDENT + "at " + ste.toString());
       dump.append("\n");
       for (int j = 1; j < monitors.length; j++) {
           MonitorInfo mi = monitors[j];
           if (mi.getLockedStackDepth() == i) {
               dump.append(INDENT + "  - locked " + mi);
               dump.append("\n");
           }
       }
   }
   dump.append("\n");
}
 
Example 17
Project: hadoop-2.6.0-cdh5.4.3   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 18
Project: thread-dump-analysis   File: MBeanDumper.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti, StringBuilder dump) {
   // print thread information
   printThread(ti, dump);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       dump.append(INDENT + "at " + ste.toString());
       dump.append("\n");
       for (int j = 1; j < monitors.length; j++) {
           MonitorInfo mi = monitors[j];
           if (mi.getLockedStackDepth() == i) {
               dump.append(INDENT + "  - locked " + mi);
               dump.append("\n");
           }
       }
   }
   dump.append("\n");
}
 
Example 19
Project: hadoop-plus   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 20
Project: pbase   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 21
Project: mapleLemon   File: DeadlockDetector.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo threadInfo) {
    printThread(threadInfo);
    this.sb.append(INDENT).append(threadInfo.toString()).append("\n");
    StackTraceElement[] stacktrace = threadInfo.getStackTrace();
    MonitorInfo[] monitors = threadInfo.getLockedMonitors();

    for (int i = 0; i < stacktrace.length; i++) {
        StackTraceElement ste = stacktrace[i];
        this.sb.append(INDENT).append("at ").append(ste.toString()).append("\n");
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == i) {
                this.sb.append(INDENT).append("  - locked ").append(mi).append("\n");
            }
        }
    }
}
 
Example 22
Project: scheduling   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, StringBuilder sb) {
    // print thread information
    printThread(ti, sb);

    // print stack trace with locks
    StackTraceElement[] stacktrace = ti.getStackTrace();
    MonitorInfo[] monitors = ti.getLockedMonitors();
    for (int i = 0; i < stacktrace.length; i++) {
        StackTraceElement ste = stacktrace[i];
        sb.append(INDENT);
        sb.append("at ");
        sb.append(ste.toString());
        sb.append(System.getProperty("line.separator"));
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == i) {
                sb.append(INDENT);
                sb.append("  - locked ");
                sb.append(mi);
                sb.append(System.getProperty("line.separator"));
            }
        }
    }
    sb.append(System.getProperty("line.separator"));
}
 
Example 23
Project: artifactory   File: ThreadDumper.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti, StringBuilder dump) {
    // print thread information
    printThread(ti, dump);

    // print stack trace with locks
    StackTraceElement[] stacktrace = ti.getStackTrace();
    MonitorInfo[] monitors = ti.getLockedMonitors();
    for (int i = 0; i < stacktrace.length; i++) {
        StackTraceElement ste = stacktrace[i];
        dump.append(TAB).append("at ").append(ste.toString()).append('\n');
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == i) {
                dump.append(TAB).append("  - locked ").append(mi).append('\n');
            }
        }
    }
    dump.append("");
}
 
Example 24
Project: infobip-open-jdk-8   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 25
Project: jdk8u-dev-jdk   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 26
Project: hops   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 27
Project: jdk7-jdk   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 28
Project: openjdk-source-code-learn   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 29
Project: hbase   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 30
Project: OLD-OpenJDK8   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 31
Project: hadoop-TCP   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 32
Project: Tweakkit-Server   File: WatchdogThread.java   Source Code and License 6 votes vote down vote up
private static void dumpThread(ThreadInfo thread, Logger log)
{
    log.log( Level.SEVERE, "------------------------------" );
    //
    log.log( Level.SEVERE, "Current Thread: " + thread.getThreadName() );
    log.log( Level.SEVERE, "\tPID: " + thread.getThreadId()
            + " | Suspended: " + thread.isSuspended()
            + " | Native: " + thread.isInNative()
            + " | State: " + thread.getThreadState() );
    if ( thread.getLockedMonitors().length != 0 )
    {
        log.log( Level.SEVERE, "\tThread is waiting on monitor(s):" );
        for ( MonitorInfo monitor : thread.getLockedMonitors() )
        {
            log.log( Level.SEVERE, "\t\tLocked on:" + monitor.getLockedStackFrame() );
        }
    }
    log.log( Level.SEVERE, "\tStack:" );
    //
    for ( StackTraceElement stack : thread.getStackTrace() )
    {
        log.log( Level.SEVERE, "\t\t" + stack );
    }
}
 
Example 33
Project: pinpoint   File: ThreadDumpUtils.java   Source Code and License 6 votes vote down vote up
private static void setMonitorInfo(TThreadDump threadDump, ThreadInfo threadInfo) {
    MonitorInfo[] monitorInfos = threadInfo.getLockedMonitors();
    if (monitorInfos != null) {
        for (MonitorInfo each : monitorInfos) {
            if (each == null) {
                continue;
            }
            TMonitorInfo tMonitorInfo = new TMonitorInfo();

            tMonitorInfo.setStackDepth(each.getLockedStackDepth());
            tMonitorInfo.setStackFrame(each.getLockedStackFrame().toString());

            threadDump.addToLockedMonitors(tMonitorInfo);
        }
    } else {
        threadDump.setLockedMonitors(Collections.<TMonitorInfo>emptyList());
    }
}
 
Example 34
Project: hardfs   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 35
Project: hadoop-on-lustre2   File: TimedOutTestsListener.java   Source Code and License 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 36
Project: openjdk-jdk7u-jdk   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 37
Project: utilsj   File: ThreadDumperJdk16.java   Source Code and License 6 votes vote down vote up
@Override
int outputMonitors(ThreadInfo info, int stack_depth, int monitor_pointer, StringBuffer buffer) {
    MonitorInfo[] locked_monitors = info.getLockedMonitors();
    boolean check_next_monitor;
    do
    {
        check_next_monitor = false;
        if (monitor_pointer < locked_monitors.length)
        {
            MonitorInfo monitor_info = locked_monitors[monitor_pointer];
            if (monitor_info.getLockedStackDepth() == stack_depth)
            {
                formatLock(monitor_info, "locked", buffer);
                buffer.append("\n");
                monitor_pointer++;
                check_next_monitor = true;
            }
        }
    } while (check_next_monitor);

    return monitor_pointer;
}
 
Example 38
Project: SpigotSource   File: WatchdogThread.java   Source Code and License 6 votes vote down vote up
private static void dumpThread(ThreadInfo thread, Logger log)
{
    log.log( Level.SEVERE, "------------------------------" );
    //
    log.log( Level.SEVERE, "Current Thread: " + thread.getThreadName() );
    log.log( Level.SEVERE, "\tPID: " + thread.getThreadId()
            + " | Suspended: " + thread.isSuspended()
            + " | Native: " + thread.isInNative()
            + " | State: " + thread.getThreadState() );
    if ( thread.getLockedMonitors().length != 0 )
    {
        log.log( Level.SEVERE, "\tThread is waiting on monitor(s):" );
        for ( MonitorInfo monitor : thread.getLockedMonitors() )
        {
            log.log( Level.SEVERE, "\t\tLocked on:" + monitor.getLockedStackFrame() );
        }
    }
    log.log( Level.SEVERE, "\tStack:" );
    //
    for ( StackTraceElement stack : thread.getStackTrace() )
    {
        log.log( Level.SEVERE, "\t\t" + stack );
    }
}
 
Example 39
Project: openjdk-icedtea7   File: ThreadMonitor.java   Source Code and License 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 40
Project: incubator-netbeans   File: NbTestCase.java   Source Code and License 5 votes vote down vote up
private static void printMonitorInfo(ThreadInfo ti, MonitorInfo[] monitors, StringBuilder sb) {
    sb.append("\tLocked monitors: count = " + monitors.length).append("\n");
    for (MonitorInfo mi : monitors) {
        sb.append("\t  - " + mi + " locked at ").append("\n");
        sb.append("\t      " + mi.getLockedStackDepth() + " "
                + mi.getLockedStackFrame()).append("\n");
    }
}
 
Example 41
Project: incubator-netbeans   File: Detector.java   Source Code and License 5 votes vote down vote up
private void printMonitorInfo(ThreadInfo ti, PrintStream out) {
   MonitorInfo[] monitors = ti.getLockedMonitors();
   out.println(INDENT + "Locked monitors: count = " + monitors.length); // NOI18N
   for (MonitorInfo mi : monitors) {
       out.println(INDENT + "  - " + mi + " locked at "); // NOI18N
       out.println(INDENT + "      " + mi.getLockedStackDepth() + // NOI18N
                          " " + mi.getLockedStackFrame());       // NOI18N
   }
}
 
Example 42
Project: incubator-netbeans   File: ThreadDumpWindow.java   Source Code and License 5 votes vote down vote up
private void printMonitors(final StringBuilder sb, final MonitorInfo[] monitors, final int index) {
    if (monitors != null) {
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == index) {
                sb.append("    - locked ");   // NOI18N
                printLock(sb, mi);
                sb.append("<br>");    // NOI18N
            }
        }
    }
}
 
Example 43
Project: incubator-netbeans   File: SampledCPUSnapshot.java   Source Code and License 5 votes vote down vote up
private void printMonitors(final StringBuilder sb, final MonitorInfo[] monitors, final int index) {
    if (monitors != null) {
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == index) {
                sb.append("\t- locked ");   // NOI18N
                printLock(sb,mi);
                sb.append("<br>");    // NOI18N
            }
        }
    }
}
 
Example 44
Project: Uranium   File: WatchdogThread.java   Source Code and License 5 votes vote down vote up
private static void dumpThread(ThreadInfo thread, Logger log, Level level)
{
    if (thread == null) return;
    if ( thread.getThreadState() != State.WAITING )
    {
        log.log( level, "------------------------------" );
        //
        log.log( level, "Current Thread: " + thread.getThreadName() );
        log.log( level, "\tPID: " + thread.getThreadId()
                + " | Suspended: " + thread.isSuspended()
                + " | Native: " + thread.isInNative()
                + " | State: " + thread.getThreadState() 
                + " | Blocked Time: " + thread.getBlockedTime()     // Cauldron add info about blocked time
                + " | Blocked Count: " + thread.getBlockedCount()); // Cauldron add info about blocked count
        
        if ( thread.getLockedMonitors().length != 0 )
        {
            log.log( level, "\tThread is waiting on monitor(s):" );
            for ( MonitorInfo monitor : thread.getLockedMonitors() )
            {
                log.log( level, "\t\tLocked on:" + monitor.getLockedStackFrame() );
            }
        }
        if ( thread.getLockOwnerId() != -1 ) log.log( level, "\tLock Owner Id: " + thread.getLockOwnerId()); // Cauldron + add info about lock owner thread id
        log.log( level, "\tStack:" );
        //
        StackTraceElement[] stack = thread.getStackTrace();
        for ( int line = 0; line < stack.length; line++ )
        {
            log.log( level, "\t\t" + stack[line].toString() );
        }
    }
}
 
Example 45
Project: NoMoreOversleeps   File: DebugHandler.java   Source Code and License 5 votes vote down vote up
/** Returns an array list of debug information for all Java threads; useful for trying to diagnose the cause of odd behaviour.
 * 
 * @return An array list of debug information
 */
public static ArrayList<String> getThreadDebugData()
{
	ArrayList<String> strings = new ArrayList<String>();

	strings.add("------------------------------------------------------------");
	strings.add("Debugging information for Java virtual machine");
	ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
	for (ThreadInfo thread : threads)
	{
		if (thread.getThreadState() != State.WAITING)
		{
			strings.add("------------------------------------------------------------");
			strings.add(thread.getThreadName());
			strings.add("\tPID: " + thread.getThreadId() + " | Suspended: " + thread.isSuspended() + " | Native: " + thread.isInNative() + " | State: " + thread.getThreadState());
			if (thread.getLockedMonitors().length != 0)
			{
				strings.add("\tThread is waiting on monitor(s):");
				for (MonitorInfo monitor : thread.getLockedMonitors())
				{
					strings.add("\t\tLocked on:" + monitor.getLockedStackFrame());
				}
			}
			strings.add("\tStack trace:");

			StackTraceElement[] stack = thread.getStackTrace();
			for (int line = 0; line < stack.length; line++)
			{
				strings.add("\t\t" + stack[line].toString());
			}
		}
	}
	strings.add("------------------------------------------------------------");
	strings.add("End of debugging information");
	strings.add("------------------------------------------------------------");

	return strings;
}
 
Example 46
Project: NapBot   File: DebugHandler.java   Source Code and License 5 votes vote down vote up
/** Returns an array list of debug information for all Java threads; useful for trying to diagnose the cause of odd behaviour.
 * 
 * @return An array list of debug information
 */
public static ArrayList<String> getThreadDebugData()
{
	ArrayList<String> strings = new ArrayList<String>();

	strings.add("------------------------------------------------------------");
	strings.add("Debugging information for Java virtual machine");
	ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
	for (ThreadInfo thread : threads)
	{
		if (thread.getThreadState() != State.WAITING)
		{
			strings.add("------------------------------------------------------------");
			strings.add(thread.getThreadName());
			strings.add("\tPID: " + thread.getThreadId() + " | Suspended: " + thread.isSuspended() + " | Native: " + thread.isInNative() + " | State: " + thread.getThreadState());
			if (thread.getLockedMonitors().length != 0)
			{
				strings.add("\tThread is waiting on monitor(s):");
				for (MonitorInfo monitor : thread.getLockedMonitors())
				{
					strings.add("\t\tLocked on:" + monitor.getLockedStackFrame());
				}
			}
			strings.add("\tStack trace:");

			StackTraceElement[] stack = thread.getStackTrace();
			for (int line = 0; line < stack.length; line++)
			{
				strings.add("\t\t" + stack[line].toString());
			}
		}
	}
	strings.add("------------------------------------------------------------");
	strings.add("End of debugging information");
	strings.add("------------------------------------------------------------");

	return strings;
}
 
Example 47
Project: OpenJSharp   File: ThreadMonitor.java   Source Code and License 5 votes vote down vote up
private void printMonitorInfo(ThreadInfo ti) {
   MonitorInfo[] monitors = ti.getLockedMonitors();
   System.out.println(INDENT + "Locked monitors: count = " + monitors.length);
   for (MonitorInfo mi : monitors) {
       System.out.println(INDENT + "  - " + mi + " locked at ");
       System.out.println(INDENT + "      " + mi.getLockedStackDepth() +
                          " " + mi.getLockedStackFrame());
   }
}
 
Example 48
Project: OpenJSharp   File: MappedMXBeanType.java   Source Code and License 5 votes vote down vote up
Object toOpenTypeData(Object data) throws OpenDataException {
    if (data instanceof MemoryUsage) {
        return MemoryUsageCompositeData.toCompositeData((MemoryUsage) data);
    }

    if (data instanceof ThreadInfo) {
        return ThreadInfoCompositeData.toCompositeData((ThreadInfo) data);
    }

    if (data instanceof LockInfo) {
        if (data instanceof java.lang.management.MonitorInfo) {
            return MonitorInfoCompositeData.toCompositeData((MonitorInfo) data);
        }
        return LockInfoCompositeData.toCompositeData((LockInfo) data);
    }

    if (data instanceof MemoryNotificationInfo) {
        return MemoryNotifInfoCompositeData.
            toCompositeData((MemoryNotificationInfo) data);
    }

    if (data instanceof VMOption) {
        return VMOptionCompositeData.toCompositeData((VMOption) data);
    }

    if (isCompositeData) {
        // Classes that implement CompositeData
        //
        // construct a new CompositeDataSupport object
        // so that no other classes are sent over the wire
        CompositeData cd = (CompositeData) data;
        CompositeType ct = cd.getCompositeType();
        String[] itemNames = ct.keySet().toArray(new String[0]);
        Object[] itemValues = cd.getAll(itemNames);
        return new CompositeDataSupport(ct, itemNames, itemValues);
    }

    throw new OpenDataException(javaClass.getName() +
        " is not supported for platform MXBeans");
}
 
Example 49
Project: OpenJSharp   File: ThreadInfoCompositeData.java   Source Code and License 5 votes vote down vote up
public MonitorInfo[] lockedMonitors() {
    CompositeData[] lockedMonitorsData =
        (CompositeData[]) cdata.get(LOCKED_MONITORS);

    // The LockedMonitors item cannot be null, but if it is we will get
    // a NullPointerException when we ask for its length.
    MonitorInfo[] monitors =
        new MonitorInfo[lockedMonitorsData.length];
    for (int i = 0; i < lockedMonitorsData.length; i++) {
        CompositeData cdi = lockedMonitorsData[i];
        monitors[i] = MonitorInfo.from(cdi);
    }
    return monitors;
}
 
Example 50
Project: monarch   File: LocalThread.java   Source Code and License 5 votes vote down vote up
private String generateThreadStack(ThreadInfo info) {
  // This is annoying, but the to string method on info sucks.
  StringBuilder result = new StringBuilder();
  result.append(info.getThreadName()).append(" ID=0x")
      .append(Long.toHexString(info.getThreadId())).append("(").append(info.getThreadId())
      .append(") state=").append(info.getThreadState());


  if (info.getLockInfo() != null) {
    result.append("\n\twaiting to lock <" + info.getLockInfo() + ">");
  }
  for (StackTraceElement element : info.getStackTrace()) {
    result.append("\n\tat " + element);
    for (MonitorInfo monitor : info.getLockedMonitors()) {
      if (element.equals(monitor.getLockedStackFrame())) {
        result.append("\n\tlocked <" + monitor + ">");
      }
    }
  }

  if (info.getLockedSynchronizers().length > 0) {
    result.append("\nLocked synchronizers:");
    for (LockInfo sync : info.getLockedSynchronizers()) {
      result.append(
          "\n" + sync.getClassName() + "@" + Integer.toHexString(sync.getIdentityHashCode()));

    }
  }

  return result.toString();
}
 
Example 51
Project: monarch   File: LocalLockInfo.java   Source Code and License 5 votes vote down vote up
public LocalLockInfo(Serializable locatility, LockInfo sync) {
  super();
  this.locatility = locatility;
  // LockInfo and Monitor info aren't serializable, so copy the information from
  // them. For backwards compatibility, use the LI class which is used
  // in older versions of gemfire.
  if (sync instanceof MonitorInfo) {
    this.info = new LI(sync.getClassName(), sync.getIdentityHashCode(),
        ((MonitorInfo) sync).getLockedStackFrame());
  } else {
    this.info = new LI(sync.getClassName(), sync.getIdentityHashCode());
  }
}
 
Example 52
Project: jdk8u-jdk   File: ThreadMonitor.java   Source Code and License 5 votes vote down vote up
private void printMonitorInfo(ThreadInfo ti) {
   MonitorInfo[] monitors = ti.getLockedMonitors();
   System.out.println(INDENT + "Locked monitors: count = " + monitors.length);
   for (MonitorInfo mi : monitors) {
       System.out.println(INDENT + "  - " + mi + " locked at ");
       System.out.println(INDENT + "      " + mi.getLockedStackDepth() +
                          " " + mi.getLockedStackFrame());
   }
}
 
Example 53
Project: jdk8u-jdk   File: MappedMXBeanType.java   Source Code and License 5 votes vote down vote up
Object toOpenTypeData(Object data) throws OpenDataException {
    if (data instanceof MemoryUsage) {
        return MemoryUsageCompositeData.toCompositeData((MemoryUsage) data);
    }

    if (data instanceof ThreadInfo) {
        return ThreadInfoCompositeData.toCompositeData((ThreadInfo) data);
    }

    if (data instanceof LockInfo) {
        if (data instanceof java.lang.management.MonitorInfo) {
            return MonitorInfoCompositeData.toCompositeData((MonitorInfo) data);
        }
        return LockInfoCompositeData.toCompositeData((LockInfo) data);
    }

    if (data instanceof MemoryNotificationInfo) {
        return MemoryNotifInfoCompositeData.
            toCompositeData((MemoryNotificationInfo) data);
    }

    if (data instanceof VMOption) {
        return VMOptionCompositeData.toCompositeData((VMOption) data);
    }

    if (isCompositeData) {
        // Classes that implement CompositeData
        //
        // construct a new CompositeDataSupport object
        // so that no other classes are sent over the wire
        CompositeData cd = (CompositeData) data;
        CompositeType ct = cd.getCompositeType();
        String[] itemNames = ct.keySet().toArray(new String[0]);
        Object[] itemValues = cd.getAll(itemNames);
        return new CompositeDataSupport(ct, itemNames, itemValues);
    }

    throw new OpenDataException(javaClass.getName() +
        " is not supported for platform MXBeans");
}
 
Example 54
Project: jdk8u-jdk   File: ThreadInfoCompositeData.java   Source Code and License 5 votes vote down vote up
public MonitorInfo[] lockedMonitors() {
    CompositeData[] lockedMonitorsData =
        (CompositeData[]) cdata.get(LOCKED_MONITORS);

    // The LockedMonitors item cannot be null, but if it is we will get
    // a NullPointerException when we ask for its length.
    MonitorInfo[] monitors =
        new MonitorInfo[lockedMonitorsData.length];
    for (int i = 0; i < lockedMonitorsData.length; i++) {
        CompositeData cdi = lockedMonitorsData[i];
        monitors[i] = MonitorInfo.from(cdi);
    }
    return monitors;
}
 
Example 55
Project: openjdk-jdk10   File: ThreadInfoCompositeData.java   Source Code and License 5 votes vote down vote up
public MonitorInfo[] lockedMonitors() {
    CompositeData[] lockedMonitorsData =
        (CompositeData[]) cdata.get(LOCKED_MONITORS);

    // The LockedMonitors item cannot be null, but if it is we will get
    // a NullPointerException when we ask for its length.
    MonitorInfo[] monitors =
        new MonitorInfo[lockedMonitorsData.length];
    for (int i = 0; i < lockedMonitorsData.length; i++) {
        CompositeData cdi = lockedMonitorsData[i];
        monitors[i] = MonitorInfo.from(cdi);
    }
    return monitors;
}
 
Example 56
Project: lazycat   File: Diagnostics.java   Source Code and License 5 votes vote down vote up
/**
 * Formats the thread dump for one thread.
 *
 * @param ti
 *            the ThreadInfo describing the thread
 * @return the formatted thread dump
 */
private static String getThreadDump(ThreadInfo ti) {
	StringBuilder sb = new StringBuilder(getThreadDumpHeader(ti));
	for (LockInfo li : ti.getLockedSynchronizers()) {
		sb.append(INDENT2 + "locks " + li.toString() + CRLF);
	}
	boolean start = true;
	StackTraceElement[] stes = ti.getStackTrace();
	Object[] monitorDepths = new Object[stes.length];
	MonitorInfo[] mis = ti.getLockedMonitors();
	for (int i = 0; i < mis.length; i++) {
		monitorDepths[mis[i].getLockedStackDepth()] = mis[i];
	}
	for (int i = 0; i < stes.length; i++) {
		StackTraceElement ste = stes[i];
		sb.append(INDENT2 + "at " + ste.toString() + CRLF);
		if (start) {
			if (ti.getLockName() != null) {
				sb.append(INDENT2 + "- waiting on (a " + ti.getLockName() + ")");
				if (ti.getLockOwnerName() != null) {
					sb.append(" owned by " + ti.getLockOwnerName() + " Id=" + ti.getLockOwnerId());
				}
				sb.append(CRLF);
			}
			start = false;
		}
		if (monitorDepths[i] != null) {
			MonitorInfo mi = (MonitorInfo) monitorDepths[i];
			sb.append(INDENT2 + "- locked (a " + mi.toString() + ")" + " index " + mi.getLockedStackDepth()
					+ " frame " + mi.getLockedStackFrame().toString());
			sb.append(CRLF);

		}
	}
	return sb.toString();
}
 
Example 57
Project: openjdk9   File: ThreadMonitor.java   Source Code and License 5 votes vote down vote up
private void printMonitorInfo(ThreadInfo ti) {
   MonitorInfo[] monitors = ti.getLockedMonitors();
   System.out.println(INDENT + "Locked monitors: count = " + monitors.length);
   for (MonitorInfo mi : monitors) {
       System.out.println(INDENT + "  - " + mi + " locked at ");
       System.out.println(INDENT + "      " + mi.getLockedStackDepth() +
                          " " + mi.getLockedStackFrame());
   }
}
 
Example 58
Project: openjdk9   File: ThreadInfoCompositeData.java   Source Code and License 5 votes vote down vote up
public MonitorInfo[] lockedMonitors() {
    CompositeData[] lockedMonitorsData =
        (CompositeData[]) cdata.get(LOCKED_MONITORS);

    // The LockedMonitors item cannot be null, but if it is we will get
    // a NullPointerException when we ask for its length.
    MonitorInfo[] monitors =
        new MonitorInfo[lockedMonitorsData.length];
    for (int i = 0; i < lockedMonitorsData.length; i++) {
        CompositeData cdi = lockedMonitorsData[i];
        monitors[i] = MonitorInfo.from(cdi);
    }
    return monitors;
}
 
Example 59
Project: FPAgar   File: StatsUtils.java   Source Code and License 5 votes vote down vote up
public static CharSequence getThreadStats(boolean lockedMonitors, boolean lockedSynchronizers, boolean stackTrace)
{
	StringBuilder list = new StringBuilder();

	for(ThreadInfo info : threadMXbean.dumpAllThreads(lockedMonitors, lockedSynchronizers))
	{
		list.append("Thread #").append(info.getThreadId()).append(" (").append(info.getThreadName()).append(")").append("\n");
		list.append("=================================================\n");
		list.append("\tgetThreadState: ...... ").append(info.getThreadState()).append("\n");
		for(MonitorInfo monitorInfo : info.getLockedMonitors())
		{
			list.append("\tLocked monitor: ....... ").append(monitorInfo).append("\n");
			list.append("\t\t[").append(monitorInfo.getLockedStackDepth()).append(".]: at ").append(monitorInfo.getLockedStackFrame()).append("\n");
		}

		for(LockInfo lockInfo : info.getLockedSynchronizers())
			list.append("\tLocked synchronizer: ...").append(lockInfo).append("\n");

		if(stackTrace)
		{
			list.append("\tgetStackTace: ..........\n");
			for(StackTraceElement trace : info.getStackTrace())
				list.append("\t\tat ").append(trace).append("\n");
		}
		list.append("=================================================\n");
	}

	return list;
}
 
Example 60
Project: gemfirexd-oss   File: CF6Impl.java   Source Code and License 5 votes vote down vote up
@Override
public LI[] getLockedMonitors(ThreadInfo info) {
  MonitorInfo[] monitors = info.getLockedMonitors();
  if(monitors == null) {
    return null;
  }
  LI[] results = new LI[monitors.length];
  for(int i = 0; i < monitors.length; i++) {
    results[i] = new LI(monitors[i].getClassName(), monitors[i].getIdentityHashCode(), monitors[i].getLockedStackFrame());
  }
  return results;
}