package com.ed.cnc.servletListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import com.ed.cnc.city.StatisticsTask;
/**
* 统计ContextListener
* @author westd
*
*/
public class StatisticsContextListener implements ServletContextListener
{
private java.util.Timer timer = null;
public void contextInitialized(ServletContextEvent event)
{
timer = new java.util.Timer(true);
event.getServletContext().log("定时器已启动");
timer.schedule(new StatisticsTask(event.getServletContext()), 0, 60*60*1000);//
event.getServletContext().log("已经添加任务调度表");
}
public void contextDestroyed(ServletContextEvent event)
{
timer.cancel();
event.getServletContext().log("定时器销毁");
}
}