diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java index a24b8703487f..3629a1f2df19 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java @@ -715,9 +715,11 @@ else if (isDetailedDump()) threads.add(baseThreadInfo + " @ " + (trace.length > 0 ? trace[0].toString() : "???")); } - dumpObjects(out, indent, new DumpableCollection("threads", threads)); + DumpableCollection threadsDump = new DumpableCollection("threads", threads); if (isDetailedDump()) - dumpObjects(out, indent, new DumpableCollection("jobs", new ArrayList<>(getQueue()))); + dumpObjects(out, indent, threadsDump, new DumpableCollection("jobs", new ArrayList<>(getQueue()))); + else + dumpObjects(out, indent, threadsDump); } private String getKnownMethod(StackTraceElement[] trace) diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java index d3e5c5170efd..d2f0e745762a 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java @@ -778,8 +778,8 @@ public void testDump() throws Exception assertThat(count(dump, " - STARTED"), is(2)); assertThat(dump, containsString(",3<=3<=4,i=3,r=2,q=0")); assertThat(dump, containsString("[ReservedThreadExecutor@")); - assertThat(count(dump, " IDLE "), is(3)); - assertThat(count(dump, " RESERVED "), is(0)); + assertThat(count(dump, " IDLE"), is(3)); + assertThat(count(dump, " RESERVED"), is(0)); CountDownLatch started = new CountDownLatch(1); CountDownLatch waiting = new CountDownLatch(1); @@ -801,9 +801,9 @@ public void testDump() throws Exception assertThat(count(dump, " - STARTED"), is(2)); assertThat(dump, containsString(",3<=3<=4,i=2,r=2,q=0")); assertThat(dump, containsString("[ReservedThreadExecutor@")); - assertThat(count(dump, " IDLE "), is(2)); - assertThat(count(dump, " WAITING "), is(1)); - assertThat(count(dump, " RESERVED "), is(0)); + assertThat(count(dump, " IDLE"), is(2)); + assertThat(count(dump, " WAITING"), is(1)); + assertThat(count(dump, " RESERVED"), is(0)); assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(0)); pool.setDetailedDump(true); @@ -812,9 +812,9 @@ public void testDump() throws Exception assertThat(dump, containsString(",3<=3<=4,i=2,r=2,q=0")); assertThat(dump, containsString("s=0/2")); assertThat(dump, containsString("[ReservedThreadExecutor@")); - assertThat(count(dump, " IDLE "), is(2)); - assertThat(count(dump, " WAITING "), is(1)); - assertThat(count(dump, " RESERVED "), is(0)); + assertThat(count(dump, " IDLE"), is(2)); + assertThat(count(dump, " WAITING"), is(1)); + assertThat(count(dump, " RESERVED"), is(0)); assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(1)); assertFalse(pool.tryExecute(() -> @@ -827,9 +827,9 @@ public void testDump() throws Exception assertThat(dump, containsString(",3<=3<=4,i=1,r=2,q=0")); assertThat(dump, containsString("s=1/2")); assertThat(dump, containsString("[ReservedThreadExecutor@")); - assertThat(count(dump, " IDLE "), is(1)); - assertThat(count(dump, " WAITING "), is(1)); - assertThat(count(dump, " RESERVED "), is(1)); + assertThat(count(dump, " IDLE"), is(1)); + assertThat(count(dump, " WAITING"), is(1)); + assertThat(count(dump, " RESERVED"), is(1)); assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(1)); }