Merge pull request #2170 from justmehyp/master

精简对齐秒数的代码逻辑
master
许雪里 4 years ago committed by GitHub
commit 71aefd7854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      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() {
while (!ringThreadToStop) {
// align second
try {
TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis()%1000 );
TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis() % 1000);
} catch (InterruptedException e) {
if (!ringThreadToStop) {
logger.error(e.getMessage(), e);
}
}
while (!ringThreadToStop) {
try {
// second data
List<Integer> 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");
}

Loading…
Cancel
Save