Skip to content

Commit

Permalink
Merge pull request #2170 from justmehyp/master
Browse files Browse the repository at this point in the history
精简对齐秒数的代码逻辑
  • Loading branch information
xuxueli committed Feb 9, 2021
2 parents 931efac + 2e6aecd commit 71aefd7
Showing 1 changed file with 9 additions and 18 deletions.
Expand Up @@ -222,17 +222,17 @@ public void run() {
@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<Integer> ringItemData = new ArrayList<>();
Expand Down Expand Up @@ -260,15 +260,6 @@ public void run() {
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");
}
Expand Down

0 comments on commit 71aefd7

Please sign in to comment.