package cn.com.qmth.stmms.biz.exam.thread;

import java.util.Date;

import org.apache.log4j.Logger;

public abstract class AbstractTask implements Runnable {

    protected static final Logger logger = Logger.getLogger(AbstractTask.class);

    private Date start;

    private Date finish;

    private String status;

    public AbstractTask() {
        status("等待开始");
    }

    @Override
    public void run() {
        logger.info("运行中");
        start = new Date();
        status("运行中");

        process();

        status("任务结束");
        finish = new Date();
        logger.info("任务结束");
    }

    protected abstract void process();

    protected void status(String status) {
        this.status = status;
    }

    public Date getStart() {
        return start;
    }

    public Date getFinish() {
        return finish;
    }

    public String getStatus() {
        return status;
    }

}
