From c8b84e0291d8ec6dae7f81a34e2b332c595659bc Mon Sep 17 00:00:00 2001 From: John Myers Date: Fri, 13 Mar 2015 13:04:11 -0700 Subject: [PATCH] [Bug 462098] Support setting ThreadGroup in QueuedThreadPool Signed-off-by: John Gardiner Myers --- .../org/eclipse/jetty/util/thread/QueuedThreadPool.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) mode change 100644 => 100755 jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java 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 old mode 100644 new mode 100755 index 425b7c5fb73..f0bb6f884b8 --- 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 @@ -54,6 +54,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo private final ConcurrentLinkedQueue _threads = new ConcurrentLinkedQueue<>(); private final Object _joinLock = new Object(); private final BlockingQueue _jobs; + private final ThreadGroup _threadGroup; private String _name = "qtp" + hashCode(); private int _idleTimeout; private int _maxThreads; @@ -83,6 +84,11 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo } public QueuedThreadPool(@Name("maxThreads") int maxThreads, @Name("minThreads") int minThreads, @Name("idleTimeout") int idleTimeout, @Name("queue") BlockingQueue queue) + { + this(maxThreads, minThreads, idleTimeout, queue, null); + } + + public QueuedThreadPool(@Name("maxThreads") int maxThreads, @Name("minThreads") int minThreads, @Name("idleTimeout") int idleTimeout, @Name("queue") BlockingQueue queue, @Name("threadGroup") ThreadGroup threadGroup) { setMinThreads(minThreads); setMaxThreads(maxThreads); @@ -95,6 +101,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo queue=new BlockingArrayQueue<>(capacity, capacity); } _jobs=queue; + _threadGroup=threadGroup; } @Override @@ -461,7 +468,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo protected Thread newThread(Runnable runnable) { - return new Thread(runnable); + return new Thread(_threadGroup, runnable); } @Override