Start a process as soon as Application Server starts

Start a process as soon as Application Server starts

Post by nkunap » Fri, 20 Jan 2006 04:48:08


I have a process which is packaged in a JAR file and what it does is
collect some statistics on the server and email it as soon as the
Application Server (Tomcat/WebSphere...etc) starts automatically? Can
this be achieved?

Thanks.
 
 
 

Start a process as soon as Application Server starts

Post by Larr » Fri, 20 Jan 2006 05:34:52


Yes, you can. First, create a servlet and reference your process in
the servlet's init() method. Then, in your web.xml file, put this line
in your servlet's <servlet> definition block:
<load-on-startup>1</load-on-startup> This will force the app server to
load your servlet when it starts and the servlet's init() method will
run as soon as the servlet is loaded, kicking off your process.

Larry

 
 
 

Start a process as soon as Application Server starts

Post by nkunap » Fri, 20 Jan 2006 06:11:58

Thanks Larry for the information. In that case, will it possible for
the same process to get kicked off say every 2 minutes. Also, add a
check that if the previous process was still not finished don't start
the subsequent process. Should all this be implemented in my code using
Timer classes etc or is there any builtin functionality to achieve the
same?

Thanks.