From b2804a15c22dabc2f10c9fb8f17859500182d468 Mon Sep 17 00:00:00 2001 From: sunhao Date: Wed, 24 Nov 2021 11:09:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=E3=80=90=E5=B9=B6?= =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95=E5=90=8E=E6=9C=AA=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E6=B1=A0=E3=80=91=E3=80=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=97=A0=E6=84=8F=E4=B9=89=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/hutool/core/thread/ConcurrencyTester.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hutool-core/src/main/java/cn/hutool/core/thread/ConcurrencyTester.java b/hutool-core/src/main/java/cn/hutool/core/thread/ConcurrencyTester.java index 9b53d4f34..1accd2368 100644 --- a/hutool-core/src/main/java/cn/hutool/core/thread/ConcurrencyTester.java +++ b/hutool-core/src/main/java/cn/hutool/core/thread/ConcurrencyTester.java @@ -40,10 +40,12 @@ public class ConcurrencyTester { this.sf.clearWorker(); timeInterval.start(); - this.sf// - .addRepeatWorker(runnable)// - .setBeginAtSameTime(true)// 同时开始 + this.sf + .addRepeatWorker(runnable) + .setBeginAtSameTime(true) .start(); + // 停止线程池释放资源,避免空跑 + this.sf.stop(); this.interval = timeInterval.interval(); return this;