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 <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-10-23 12:05:32 +02:00
parent a0cefea29f
commit 66d6ea6799
1 changed files with 8 additions and 5 deletions

View File

@ -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<Runnable> jobs = Collections.emptyList();
if (isDetailedDump())
jobs = new ArrayList<>(getQueue());
dumpBeans(out, indent, new DumpableCollection("threads",threads), new DumpableCollection("jobs", jobs));
{
List<Runnable> jobs = new ArrayList<>(getQueue());
dumpBeans(out, indent, new DumpableCollection("threads", threads), new DumpableCollection("jobs", jobs));
}
else
{
dumpBeans(out, indent, new DumpableCollection("threads", threads));
}
}
@Override