嗨,这是我的听众课
public void contextInitialized(ServletContextEvent arg0) {
// TODO Auto-generated method stub
System.out.println("inside listener context");
Timer timer = new Timer();
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 19);
cal.set(Calendar.MINUTE, 00);
cal.set(Calendar.SECOND, 00);
Time sqlTime4 = new Time(cal.getTime().getTime());
timer.schedule(new MyTimerTask(),sqlTime4);
}
这是我的 timertask 类
package com.uttara.reg;
import java.util.Date;
import java.util.TimerTask;
public class Timer extends TimerTask {
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("inside run of timer");
}
public void scheduleAtFixedRate(TimerTask timerTask, Date executionDate, long period)
{
System.out.println("run");
// TODO Auto-generated method stub
}
}
该任务没有在特定事件中触发,任何人都可以纠正其中的问题....
提前致谢