in rest-api/src/jetbrains/buildServer/server/rest/request/DebugRequest.java [925:984]
static StringBuilder appendThreadEntry(final StringBuilder buf, final ThreadInfo threadInfo) {
buf.append("\"").append(threadInfo.getThreadName()).append("\"");
buf.append(" Id=").append(threadInfo.getThreadId()).append(" ").append(threadInfo.getThreadState());
if (threadInfo.getLockName() != null) {
buf.append(" on ").append(threadInfo.getLockName());
}
if (threadInfo.getLockOwnerName() != null) {
buf.append("\n "); //buf.append(" owned"); using non-standard newline, indent and "by" (instead of standard "owned by") for easier reading
buf.append(" by \"").append(threadInfo.getLockOwnerName()).append("\" Id=").append(threadInfo.getLockOwnerId());
}
if (threadInfo.isSuspended()) {
buf.append(" (suspended)");
}
if (threadInfo.isInNative()) {
buf.append(" (in native)");
}
buf.append('\n');
int i = 0;
for (; i < threadInfo.getStackTrace().length; i++) {
StackTraceElement ste = threadInfo.getStackTrace()[i];
buf.append(" at ").append(ste.toString());
buf.append('\n');
if (i == 0 && threadInfo.getLockInfo() != null) {
Thread.State ts = threadInfo.getThreadState();
buf.append(" - ");
switch (ts) {
case BLOCKED:
buf.append("blocked on ");
break;
case WAITING:
buf.append("waiting on ");
break;
case TIMED_WAITING:
buf.append("waiting on ");
break;
default:
}
buf.append(threadInfo.getLockInfo()).append('\n');
}
for (MonitorInfo mi : threadInfo.getLockedMonitors()) {
if (mi.getLockedStackDepth() == i) {
buf.append(" - locked ").append(mi);
buf.append('\n');
}
}
}
LockInfo[] locks = threadInfo.getLockedSynchronizers();
if (locks.length > 0) {
buf.append("\n Number of locked synchronizers = ").append(locks.length);
buf.append('\n');
for (LockInfo lockInfo : locks) {
buf.append(" - ").append(lockInfo);
buf.append('\n');
}
}
buf.append('\n');
return buf;
}