Thanks for the reply. Yeah, I'm using Tomcat 4.0. Can u pls tell me some more on org.apache.catalina.Service and Context Lifecycle Listener ?
Pls also suggest which of the approaches you think better. Thanks, Sudarson -----Original Message----- From: Christopher K. St. John [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 28, 2002 8:31 PM To: [EMAIL PROTECTED] Subject: Re: start up class in tomcat Sudarson Roy Pratihar wrote: > > It's basically a job scheduler that run in a thread. With invoking the > thread in init method of a Dummy servlet class (which loads on startup), > it's running fine. Just want to know if there are other ways as well > like weblogic startup and shutdown classes. > If you want to keep generic, you can use a Context Listener. Basically you register a: javax.servlet.ServletContextListener in web.xml. See SRV.10.4 in the 2.3 spec for an example. If you're starting a scheduler thread, be sure to shut it down at the appropriate time, see: http://www.distributopia.com/servlet_stuff/background_threads.html (esp. the second entry) for some things to keep in mind. If by "Tomcat" you mean "Tomcat 4", there are several different hooks for this kind of thing, the two most likely are: - Write your own org.apache.catalina.Service, and declare it in server.xml. If it implements o.a.c.Lifecycle, then your Service's start()/stop() methods will be called when the container starts up or shuts down. - Register a Host/Engine/Context Lifecycle Listener in server.xml. See: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/index.html for details. -- Christopher St. John [EMAIL PROTECTED] DistribuTopia http://www.distributopia.com ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
