Generate a Java thread dump without restarting.

Here’s how we do it programmatically: http://pastebin.com/uS5jYpd4 We use the JMX ThreadMXBean and ThreadInfo classes: ThreadMXBean mxBean = ManagementFactory.getThreadMXBean(); ThreadInfo[] threadInfos = mxBean.getThreadInfo(mxBean.getAllThreadIds(), 0); … You can also do a kill -QUIT pid under ~unix to dump the stacks to the standard-out. There is also jstack to dump the stack of a JVM. We also … Read more

Java thread dump: BLOCKED thread without “waiting to lock …”

Apparently the situation where we observed these kinds of blocked threads were related to heavy memory consumption and therefore massive garbage collection. This question Java blocking issue: Why would JVM block threads in many different classes/methods? describes a similar situation, so I believe these threads were simply blocked by the garbage collector. (Anyway, after solving … Read more