[Bug 462098] Support setting ThreadGroup in QueuedThreadPool
Signed-off-by: John Gardiner Myers <jgmyers@proofpoint.com>
This commit is contained in:
parent
c082848f93
commit
c8b84e0291
9
jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java
Normal file → Executable file
9
jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java
Normal file → Executable file
|
@ -54,6 +54,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
|
|||
private final ConcurrentLinkedQueue<Thread> _threads = new ConcurrentLinkedQueue<>();
|
||||
private final Object _joinLock = new Object();
|
||||
private final BlockingQueue<Runnable> _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<Runnable> queue)
|
||||
{
|
||||
this(maxThreads, minThreads, idleTimeout, queue, null);
|
||||
}
|
||||
|
||||
public QueuedThreadPool(@Name("maxThreads") int maxThreads, @Name("minThreads") int minThreads, @Name("idleTimeout") int idleTimeout, @Name("queue") BlockingQueue<Runnable> 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
|
||||
|
|
Loading…
Reference in New Issue