use of org.eclipse.jetty.util.component.DumpableCollection in project jetty.project by eclipse.
the class QueuedThreadPool method dump.
@Override
public void dump(Appendable out, String indent) throws IOException {
List<Object> threads = new ArrayList<>(getMaxThreads());
for (final Thread thread : _threads) {
final StackTraceElement[] trace = thread.getStackTrace();
boolean inIdleJobPoll = false;
for (StackTraceElement t : trace) {
if ("idleJobPoll".equals(t.getMethodName())) {
inIdleJobPoll = true;
break;
}
}
final boolean idle = inIdleJobPoll;
if (isDetailedDump()) {
threads.add(new Dumpable() {
@Override
public void dump(Appendable out, String indent) throws IOException {
out.append(String.valueOf(thread.getId())).append(' ').append(thread.getName()).append(' ').append(thread.getState().toString()).append(idle ? " IDLE" : "");
if (thread.getPriority() != Thread.NORM_PRIORITY)
out.append(" prio=").append(String.valueOf(thread.getPriority()));
out.append(System.lineSeparator());
if (!idle)
ContainerLifeCycle.dump(out, indent, Arrays.asList(trace));
}
@Override
public String dump() {
return null;
}
});
} else {
int p = thread.getPriority();
threads.add(thread.getId() + " " + thread.getName() + " " + thread.getState() + " @ " + (trace.length > 0 ? trace[0] : "???") + (idle ? " IDLE" : "") + (p == Thread.NORM_PRIORITY ? "" : (" prio=" + p)));
}
}
List<Runnable> jobs = Collections.emptyList();
if (isDetailedDump())
jobs = new ArrayList<>(getQueue());
ContainerLifeCycle.dumpObject(out, this);
ContainerLifeCycle.dump(out, indent, threads, Collections.singletonList(new DumpableCollection("jobs", jobs)));
}
Aggregations