Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Start a process as soon as Application Server starts

Thread view: 
nkunapa - 18 Jan 2006 19:48 GMT
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.
Larry - 18 Jan 2006 20:34 GMT
> 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
nkunapa - 18 Jan 2006 21:11 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.