ASF Bugzilla – Attachment 28488 Details for
Bug 52955
Add a ThreadFactory implementation to the ExecutorService used to deploy applications
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
ThreadFactory implementation for ContainerBase ExecutorService
deployer-threadfactory.patch (text/plain), 2.40 KB, created by
Pid
on 2012-03-21 07:55:31 UTC
(
hide
)
Description:
ThreadFactory implementation for ContainerBase ExecutorService
Filename:
MIME Type:
Creator:
Pid
Created:
2012-03-21 07:55:31 UTC
Size:
2.40 KB
patch
obsolete
>Index: java/org/apache/catalina/core/ContainerBase.java >=================================================================== >--- java/org/apache/catalina/core/ContainerBase.java (revision 1297936) >+++ java/org/apache/catalina/core/ContainerBase.java (working copy) >@@ -31,8 +31,10 @@ > import java.util.concurrent.Callable; > import java.util.concurrent.Future; > import java.util.concurrent.LinkedBlockingQueue; >+import java.util.concurrent.ThreadFactory; > import java.util.concurrent.ThreadPoolExecutor; > import java.util.concurrent.TimeUnit; >+import java.util.concurrent.atomic.AtomicLong; > import java.util.concurrent.locks.Lock; > import java.util.concurrent.locks.ReadWriteLock; > import java.util.concurrent.locks.ReentrantReadWriteLock; >@@ -130,7 +132,24 @@ > public abstract class ContainerBase extends LifecycleMBeanBase > implements Container { > >- private static final org.apache.juli.logging.Log log= >+ /** >+ * Customisation of the deployer threads >+ */ >+ public class StartStopThreadFactory implements ThreadFactory { >+ >+ private ThreadGroup group = new ThreadGroup("tomcat-deployers"); >+ private final AtomicLong counter = new AtomicLong(0); >+ >+ @Override >+ public Thread newThread(Runnable runnable) { >+ Thread t = new Thread(group, runnable); >+ t.setName(String.format("tomcat-deployer-" + counter.getAndIncrement())); >+ return t; >+ } >+ } >+ >+ >+ private static final org.apache.juli.logging.Log log= > org.apache.juli.logging.LogFactory.getLog( ContainerBase.class ); > > /** >@@ -295,6 +314,9 @@ > private int startStopThreads = 1; > protected ThreadPoolExecutor startStopExecutor; > >+ >+ private ThreadFactory threadFactory; >+ > // ------------------------------------------------------------- Properties > > @Override >@@ -1079,12 +1101,14 @@ > > @Override > protected void initInternal() throws LifecycleException { >+ threadFactory = new StartStopThreadFactory(); > BlockingQueue<Runnable> startStopQueue = > new LinkedBlockingQueue<Runnable>(); > startStopExecutor = new ThreadPoolExecutor( > getStartStopThreadsInternal(), > getStartStopThreadsInternal(), 10, TimeUnit.SECONDS, >- startStopQueue); >+ startStopQueue, >+ threadFactory); > startStopExecutor.allowCoreThreadTimeOut(true); > super.initInternal(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 52955
: 28488