From 2e6aecdbcfe948272792fd913946b84578d38d6a Mon Sep 17 00:00:00 2001 From: justmehyp Date: Wed, 30 Dec 2020 16:22:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E5=AF=B9=E9=BD=90=E7=A7=92?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/core/thread/JobScheduleHelper.java | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java index d508b1f9..831bcf6a 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java @@ -222,17 +222,17 @@ public class JobScheduleHelper { @Override public void run() { - // align second - try { - TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis()%1000 ); - } catch (InterruptedException e) { - if (!ringThreadToStop) { - logger.error(e.getMessage(), e); - } - } - while (!ringThreadToStop) { + // align second + try { + TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis() % 1000); + } catch (InterruptedException e) { + if (!ringThreadToStop) { + logger.error(e.getMessage(), e); + } + } + try { // second data List ringItemData = new ArrayList<>(); @@ -260,15 +260,6 @@ public class JobScheduleHelper { logger.error(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread error:{}", e); } } - - // next second, align second - try { - TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis()%1000); - } catch (InterruptedException e) { - if (!ringThreadToStop) { - logger.error(e.getMessage(), e); - } - } } logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread stop"); }