⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threadpooltest.java

📁 Java样例程序集合:2D
💻 JAVA
字号:
import java.util.concurrent.*;
public class ThreadPoolTest {
	public static void main(String[] args) {
		int numWorkers = Integer.parseInt(args[0]);
		int threadPoolSize = Integer.parseInt(args[1]);

		ExecutorService tpes = Executors.newFixedThreadPool(threadPoolSize);

		WorkerThread[] workers = new WorkerThread[numWorkers];
		for (int i = 0; i < numWorkers; i++) {
			workers[i] = new WorkerThread(i);
			tpes.execute(workers[i]);
		}
		tpes.shutdown();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -