From 3e0082ce625af0ccd9aa31bb333bba0c6caac3d6 Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Mon, 27 May 2019 20:31:02 +0800 Subject: [PATCH] update document --- .../com/xxl/job/admin/core/thread/JobScheduleHelper.java | 6 ++---- 1 file changed, 2 insertions(+), 4 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 3816343f..57c16e77 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 @@ -171,7 +171,7 @@ public class JobScheduleHelper { // align second try { - TimeUnit.MILLISECONDS.sleep(System.currentTimeMillis()%1000 ); + TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis()%1000 ); } catch (InterruptedException e) { if (!toStop) { logger.error(e.getMessage(), e); @@ -181,7 +181,6 @@ public class JobScheduleHelper { int lastSecond = -1; while (!toStop) { - long start = System.currentTimeMillis(); try { // second data List ringItemData = new ArrayList<>(); @@ -219,11 +218,10 @@ public class JobScheduleHelper { logger.error(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread error:{}", e); } } - long cost = System.currentTimeMillis() - start; // next second, align second try { - TimeUnit.MILLISECONDS.sleep(1000-cost); + TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis()%1000); } catch (InterruptedException e) { if (!toStop) { logger.error(e.getMessage(), e);