Hi,
Ive created a 'StartupServlet' in my web app which has <load-on-startup> set so that it is initiallised when the webapp starts.
Problem is, the code is being run TWICE on startup.
Here is the code for the servlet:
public class StartupServlet extends HttpServlet {
Logger log = Logger.getLogger(StartupSe
rvlet.clas
s);
public static TimerTask scheduler = null;
public void init() throws ServletException {
super.init();
log.info("StartupServlet.i
nit()");
if( scheduler == null )
{
scheduler = new SchedulerService();
}
}
}
The strangest thing is that I can see from the logs that SchedulerService gets initialised twice !!
How can this be? Especially since scheduler is a static member of StartupServlet!
Any info on this gratefully received.
Start Free Trial