From 5f92862c570f3591d423b1a9aea5ac55539c3c31 Mon Sep 17 00:00:00 2001 From: Ruler Date: Thu, 9 Jul 2020 20:59:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9D=91=E7=88=B9=E7=9A=84?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E7=BA=BF=E7=A8=8B=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- java/ThreadPool.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 java/ThreadPool.java diff --git a/java/ThreadPool.java b/java/ThreadPool.java new file mode 100644 index 0000000..7ec076a --- /dev/null +++ b/java/ThreadPool.java @@ -0,0 +1,27 @@ +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * @author Ruler + * @date 2020/7/9 20:55 + */ +public class ThreadPool { + + public static void main(String[] args) { + +// 公司服务器每天固定时间就CPU爆炸,但是那时间也没什么人访问,知道我看见了这个 + +// 创建一个线程池 + ExecutorService threadPool = Executors.newFixedThreadPool(1); + +// 执行任务。。。。。 + +// 任务完毕 + threadPool.shutdown(); + while (true) { + if (threadPool.isTerminated()) { + break; + } + } + } +} -- Gitee