7165762: (aio) Default thread pool should be configured so that threads terminated after a timeout period
authoralanb
Fri, 30 Nov 2012 16:29:32 +0000
changeset 14692 9460573cd894
parent 14691 22056e110b04
child 14693 a196fa312378
7165762: (aio) Default thread pool should be configured so that threads terminated after a timeout period Reviewed-by: chegar
jdk/src/share/classes/sun/nio/ch/ThreadPool.java
--- a/jdk/src/share/classes/sun/nio/ch/ThreadPool.java	Fri Nov 30 11:18:16 2012 +0000
+++ b/jdk/src/share/classes/sun/nio/ch/ThreadPool.java	Fri Nov 30 16:29:32 2012 +0000
@@ -102,11 +102,7 @@
         if (threadFactory == null)
             threadFactory = defaultThreadFactory;
         // create thread pool
-        ExecutorService executor =
-            new ThreadPoolExecutor(0, Integer.MAX_VALUE,
-                                   Long.MAX_VALUE, TimeUnit.MILLISECONDS,
-                                   new SynchronousQueue<Runnable>(),
-                                   threadFactory);
+        ExecutorService executor = Executors.newCachedThreadPool(threadFactory);
         return new ThreadPool(executor, false, initialSize);
     }