Start a process as soon as Application Server starts

N

nkunapa

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.
 
L

Larry

nkunapa said:
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.

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
 
N

nkunapa

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top