Hi! > > I have my own java (using thread control) application. The application will invoke a thread and it will do some work once in a day and it will go to sleep. I want to run this application while the application server starts up. I heard that I can write my own servelet and in the web.xml I configure in such a way that I can run this servlet at the start up. So that I can run my application while starting up the application server. Could anybody give me a sample servlet to do the above said task. >
There's the <load-on-startup>-tag telling the app/servlet container that it should load/initiate that servlet right at the beginning. But I don't think that's what you mean, you rather want a ServletContextListener whose contextDestroyed/Initialized(...) methods get called whenever the app's context is destroyed/created. > Will the thread (running from my own application) get killed automatically when I stop the Application server. Or is there any way to stop my application while stoping the App. Server. Just put some code that kills the thread in contextDestroyed and all should be fine, but pay attention to http://www.enteract.com/~cks/distributopia/servlet_stuff/background_threads. html! HTH! -mw ___________________________________________________________________________ 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