Toru Watanabe wrote:
>
> Ying> I want a thread to run all the time while my Tomcat is running,
>
> You should put instance of thread into ServletContext.
> see following
>
> void init() { ...}
>
> void service(req, res) { ... }
>
There's a resource leak here. If you're going to start
up a thread in init(), you have to shut it down in
destroy(). Also, if your servlet container supports
version 2.3 of the servlet spec, you really want to
be using contextInitialized()/contextDestroyed() instead
of init()/destory().
But it's not really desirable to be doing any thread
spawning at all if you can avoid it. See the link posted
earlier in this thread 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