-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b08
-
generic
-
generic
-
Not verified
Shutting down a thread pool with 1000 idle threads takes on the order of 10 seconds.
The time for shutdown to complete for sufficiently large pool sizes
is quadratic in the pool size.
import java.util.*;
import java.util.concurrent.*;
public class InterruptStorm {
public static void main(String[] args) throws Throwable {
final int n = Integer.parseInt(args[0]);
final ThreadPoolExecutor pool
= new ThreadPoolExecutor(n, n, 0L, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>());
pool.prestartAllCoreThreads();
long t0 = System.nanoTime();
pool.shutdown();
pool.awaitTermination(1L, TimeUnit.HOURS);
System.out.printf("%3f%n", ((double) (System.nanoTime() - t0)/
(1000.0 * 1000.0 * 1000.0)));
}
}
The time for shutdown to complete for sufficiently large pool sizes
is quadratic in the pool size.
import java.util.*;
import java.util.concurrent.*;
public class InterruptStorm {
public static void main(String[] args) throws Throwable {
final int n = Integer.parseInt(args[0]);
final ThreadPoolExecutor pool
= new ThreadPoolExecutor(n, n, 0L, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>());
pool.prestartAllCoreThreads();
long t0 = System.nanoTime();
pool.shutdown();
pool.awaitTermination(1L, TimeUnit.HOURS);
System.out.printf("%3f%n", ((double) (System.nanoTime() - t0)/
(1000.0 * 1000.0 * 1000.0)));
}
}
- relates to
-
JDK-6576792 ThreadPoolExecutor methods leak interrupts when run in pool threads
- Resolved