in src/main/java/org/apache/sling/launchpad/app/ControlListener.java [411:464]
private void printThread(final Socket socket, final ThreadInfo thread) throws IOException {
writeLine(socket, String.format("-\"%s\" #%d",
thread.getThreadName(),
thread.getThreadId()
));
writeLine(socket, String.format("- java.lang.Thread.State: %s",
thread.getThreadState()
));
final MonitorInfo[] monitors = thread.getLockedMonitors();
final StackTraceElement[] trace = thread.getStackTrace();
for (int i=0; i < trace.length; i++) {
StackTraceElement ste = trace[i];
if (ste.isNativeMethod()) {
writeLine(socket, String.format("- at %s.%s(Native Method)",
ste.getClassName(),
ste.getMethodName()
));
} else {
writeLine(socket, String.format("- at %s.%s(%s:%d)",
ste.getClassName(),
ste.getMethodName(),
ste.getFileName(),
ste.getLineNumber()
));
}
if (i == 0 && thread.getLockInfo() != null) {
writeLine(socket, String.format("- - waiting on %s%s",
formatLockInfo(
thread.getLockInfo().getClassName(),
thread.getLockInfo().getIdentityHashCode()
),
(thread.getLockOwnerId() >= 0)
? String.format(" owned by \"%s\" #%d",
thread.getLockOwnerName(),
thread.getLockOwnerId()
):""
));
}
for (MonitorInfo mi : monitors) {
if (i == mi.getLockedStackDepth()) {
writeLine(socket, String.format("- - locked %s",
formatLockInfo(
mi.getClassName(),
mi.getIdentityHashCode()
)
));
}
}
}
}