比如这样
public final class ThreadPool {
private final static ExecutorService fixThreadPool = Executors.newFixedThreadPool(Runtime
.getRuntime().availableProcessors() + 1);
private ThreadPool() {
}
public static void execute(Runnable run) {
fixThreadPool.execute(run);
}
}
阿神2017-04-18 09:16:08
FixedThreadPool maintains an array of child threads internally, so why do you ask this question? Where is your confusion?