比如这样
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);
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
吼~你这种代码的情况下肯定是在“子线程”
FixedThreadPool就是内部维护一个子线程数组,所以你为什么要问这个问题?你的困惑在哪里?