Added NamingThreadFactory to ensure that all code creating thread pool executors was marking the threads.

Otherwise we get a bunch of pool-17-thread-5 with no clue who created so many threads or why.
Also simplifies existing code which previously had to write one-off ThreadFactory implementations just to set a name.
This commit is contained in:
Jesse Glick committed 2013-11-15 18:30:29 -05:00
1 parent 7a6c8654d9
commit b305fe082c
9 files changed
+82 -56

No files matched your search

+2 -1
View File
@@ -28,6 +28,7 @@ import hudson.model.TaskListener;
import hudson.remoting.Channel;
import hudson.util.DaemonThreadFactory;
import hudson.util.ExceptionCatchingThreadFactory;
import hudson.util.NamingThreadFactory;
import hudson.util.NullStream;
import hudson.util.StreamCopyThread;
import hudson.util.ProcessTree;
@@ -131,7 +132,7 @@ public abstract class Proc {
*/
public abstract OutputStream getStdin();
private static final ExecutorService executor = Executors.newCachedThreadPool(new ExceptionCatchingThreadFactory(new DaemonThreadFactory()));
private static final ExecutorService executor = Executors.newCachedThreadPool(new ExceptionCatchingThreadFactory(new NamingThreadFactory(new DaemonThreadFactory(), "Proc.executor")));
/**
* Like {@link #join} but can be given a maximum time to wait.