package cc.smtweb.framework.core.mvc.scheduler;

import com.serotonin.timer.TimerTask;
import com.serotonin.timer.TimerTrigger;
import lombok.extern.slf4j.Slf4j;


/**
 * 包装定时器任务
 *
 * @author xkliu
 */
@Slf4j
public class CronTimerTask extends TimerTask {
    private final AbstractJobQueue jobQueue;
    private AbstractJob job;

    CronTimerTask(TimerTrigger timerTrigger, AbstractJobQueue jobQueue, AbstractJob job) {
        super(timerTrigger);
        this.jobQueue = jobQueue;
        this.job = job;
    }

    @Override
    public void run(long time) {
        // 开启线程执行
        jobQueue.getJobExecutor().execute(jobQueue, job);
    }
}
