精简对齐秒数的代码逻辑

master
justmehyp 4 years ago
parent 3b4067a7b5
commit 2e6aecdbcf
  1. 13
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java

@ -222,6 +222,8 @@ public class JobScheduleHelper {
@Override @Override
public void run() { public void run() {
while (!ringThreadToStop) {
// align second // align second
try { try {
TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis() % 1000); TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis() % 1000);
@ -231,8 +233,6 @@ public class JobScheduleHelper {
} }
} }
while (!ringThreadToStop) {
try { try {
// second data // second data
List<Integer> ringItemData = new ArrayList<>(); List<Integer> ringItemData = new ArrayList<>();
@ -260,15 +260,6 @@ public class JobScheduleHelper {
logger.error(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread error:{}", e); 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"); logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread stop");
} }

Loading…
Cancel
Save