Generating Java Full Thread Dump


Web tier: servlets, JSP, Web frameworks: Generating Java Full Thread Dump

  1. Generating Java Full Thread Dump (1 messages)

    Hi All, I want to generate full thread dump output(like kill -3) inside JVM. First of all , is it possible (in 1.5 or older)? Is there any code example? How JVM generate this output, when kill -3 is triggered? It uses jni? How can use it in a java class? I can generate partial of this output like using for deadlock, ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); long[] ids = mbean.findMonitorDeadlockedThreads(); and for stacetrace, Map thrdMap = Thread.getAllStackTraces(); But output is not same.I want to use output to see in thread dump analyzers(it must be well-defined format). Thread.getAllStackTraces()doesnt contain - waiting to lock (a java.lang.Object). Thanks, Serdar
  2. You can call Thread.dumpStack().This will give you the stack trace for the current thread. cheers,