package com.engine.kq.timer;

import com.engine.common.timer.LogTask;
import com.engine.kq.log.KQLog;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.Timer;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

/**
 * 考勤相关定时触发器
 */
public class KQTaskTimerSchedule {
  private static Timer logTimer;

  public static void startTask() {
    new KQLog().info("KQTaskTimerSchedule:startTask in");
    logTimer = new Timer();
    KQTask kqTask = new KQTask();
    logTimer.schedule(kqTask, 5 * 1000, 60 * 1000);// 每分钟执行一次
    new KQLog().info("KQTaskTimerSchedule:startTask out");
  }

  public static void endTask() {
    new KQLog().info("KQTaskTimerSchedule:startTask in");
    logTimer.cancel();
    new KQLog().info("KQTaskTimerSchedule:startTask out");
  }
}
