package market.Qms.qcm.service.impl;
import java.util.Timer;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

/**
 * 项目启动即刻开启自动判定
 */
public class AutoJugeServlet extends HttpServlet {

    private boolean running=true;//是否开启自动判定
    private static ServletContext context;
    public static ServletContext getContext(){
    	return context;
    }
    
    public void init() throws ServletException {
    	if(running){
	    	context=this.getServletContext();
	        System.out.println("--------------开启自动判定--------------------");
	        // 自动判定
	        new Timer().scheduleAtFixedRate(new AutoJudgeTask(context),0,180*1000);
    	}
    }

}
