From 66d6ea67995e6889b13a5f0fb2f2b4a097af442f Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 23 Oct 2018 12:05:32 +0200 Subject: [PATCH] Issue #2998 - Cleanup the dump implementation. Fixed dump() in QueuedThreadPool. When the dump was not detailed, it was printing jobs=0 even if there were jobs in the queue. Given that it was adding no information (actually misleading information) and that the queue size is already reported by QueuedThreadPool.toString() the jobs are not dumped if the dump is not detailed. Signed-off-by: Simone Bordet --- .../eclipse/jetty/util/thread/QueuedThreadPool.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 a35adc3c41d..57f1986cc57 100755 --- 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 @@ -20,7 +20,6 @@ package org.eclipse.jetty.util.thread; import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.BlockingQueue; @@ -625,11 +624,15 @@ public class QueuedThreadPool extends ContainerLifeCycle implements SizedThreadP } } - List jobs = Collections.emptyList(); if (isDetailedDump()) - jobs = new ArrayList<>(getQueue()); - - dumpBeans(out, indent, new DumpableCollection("threads",threads), new DumpableCollection("jobs", jobs)); + { + List jobs = new ArrayList<>(getQueue()); + dumpBeans(out, indent, new DumpableCollection("threads", threads), new DumpableCollection("jobs", jobs)); + } + else + { + dumpBeans(out, indent, new DumpableCollection("threads", threads)); + } } @Override