<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>BootServlet</servlet-name>
<display-name>BootServlet</display-name>
<description>BootServlet</description>
<servlet-class>testweb.servlet.BootServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>BootServlet</servlet-name>
<url-pattern>/BootServlet</url-pattern>
</servlet-mapping>
</web-app>
public void init() throws ServletException
{
super.init();
// TODO Auto-generated method stub
dMsg.info("###BootServlet: execute init");
TimerService ts=TimerService.getInstance();
dMsg.info("###BootServlet: have got timerservice="+ts);
for(int i=0;i<100;i++){
TimerTask task=new MyTimerTask(""+i);
dMsg.info("###BootServlet: have created timertask="+task);
try
{
ts.addTask(task, null, -1, 10*1000);
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
dMsg.info("###BootServlet: after addtask");
}