利用ServletContextListener实现定时任务

packagecom.ed.cnc.servletListener;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客imp<wbr>ortjavax.servlet.ServletContextEvent;</wbr>

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客imp<wbr>ortjavax.servlet.ServletContextListener;</wbr>

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客imp<wbr>ortcom.ed.cnc.city.StatisticsTask;</wbr>

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客/***//**

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*统计ContextListener

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*@authorwestd

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*/

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客/***//**

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*@authorwestd

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*/

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客publicclassStatisticsContextListenerimplementsServletContextListener

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客privatejava.util.Timertimer=null;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客/***//**

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*这个方法在Web应用服务做好接受请求的时候被调用。

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*@seejavax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*/

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客publicvoidcontextInitialized(ServletContextEventevent)

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客timer=newjava.util.Timer(true);

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客event.getServletContext().log("定时器已启动");

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客timer.schedule(newStatisticsTask(event.getServletContext()),0,60*60*1000);//每隔1小时

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客event.getServletContext().log("已经添加任务调度表");

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客/***//**

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*这个方法在Web应用服务被移除,没有能力再接受请求的时候被调用。

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*@seejavax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*/

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客publicvoidcontextDestroyed(ServletContextEventevent)

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客timer.cancel();

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客event.getServletContext().log("定时器销毁");

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

一个继承于TimerTask的一个类:StatisticsTask.java

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客packagecom.ed.cnc.city;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客imp<wbr>ortjava.util.Calendar;</wbr>

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客imp<wbr>ortjava.util.TimerTask;</wbr>

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客imp<wbr>ortjavax.servlet.ServletContext;</wbr>

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客/***//**

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*统计任务

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*@authorwestd

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*/

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客publicclassStatisticsTaskextendsTimerTask

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客privatestaticfinalintSTATISTICS_SCHEDULE_HOUR=0;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客privatestaticbooleanisRunning=false;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客privateServletContextcontext=null;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客publicStatisticsTask(ServletContextcontext)

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客this.context=context;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客@Override

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客publicvoidrun()

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客Calendarcal=Calendar.getInstance();

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客//System.out.println(isRunning);

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客if(!isRunning)

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客if(STATISTICS_SCHEDULE_HOUR==cal.get(Calendar.HOUR_OF_DAY))//查看是否为凌晨

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客isRunning=true;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客context.log("开始执行指定任务");

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客//TODO添加自定义的详细任务

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客executeTask();

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客//指定任务执行结束

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客isRunning=false;

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客context.log("指定任务执行结束");

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客else

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客context.log("上一次任务执行还未结束");

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客/***//**

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*执行任务

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客*/

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客publicvoidexecuteTask()

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客{

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客System.out.println("任务1利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客");

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客System.out.println("任务2利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客");

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客}

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客

web.xml中添加如下代码:

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客<listener>

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客<listener-class>com.ed.cnc.servletListener.StatisticsContextListener</listener-class>

利用ServletContextListener实现定时任务  - 冯冯 - 冯冯的博客</listener>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值