整点执行

back_recharge
wangyuan 2019-04-10 15:59:05 +08:00
parent a17ef696d3
commit 5fd58a3472
1 changed files with 3 additions and 2 deletions

View File

@ -59,12 +59,13 @@ public class ThreadManager {
public void go() {
long now = System.currentTimeMillis();
scheduledExecutor = new ScheduledThreadPoolExecutor(16, new ScheduleThreadFactory());
// testTask 已秒为单位 延迟10s, 间隔30s为周期执行
scheduledExecutor.scheduleAtFixedRate(platConfigureTask, 10, PlatConfigureTask.SLEEP_INTEVAL_TIME, TimeUnit.SECONDS);
scheduledExecutor.scheduleAtFixedRate(new MinuteJob(), 0, 60, TimeUnit.SECONDS);
long diff = now/1000 % 60 ;
scheduledExecutor.scheduleAtFixedRate(new MinuteJob(), 60 - diff, 60, TimeUnit.SECONDS);
LOGGER.info("All Task running ...");
}