package com.chinaitop.depot.intelligent.IntelligentDetection.service;

import com.chinaitop.depot.intelligent.IntelligentDetection.model.TTimingTask;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author wzx
 * @time 2018/6/9
 */
public abstract class AbstractTask implements Job {

    private Logger logger = LoggerFactory.getLogger(AbstractTask.class);

    protected abstract void executeInternal(JobExecutionContext context);

    protected String cronExpression;

    protected TTimingTask timingTask;

    @Override
    public void execute(JobExecutionContext context) {
        try {
            executeInternal(context);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            logger.error("工作执行失败!");
        }
    }

    public String getCronExpression() {
        return cronExpression;
    }
}

