Thread stuff in J2EE is a bit complicated; you're not supposed to just start your own thread.  Here's a quote from a mail on the Tomcat list (by Erik Weber):
This is covered by JMX. For example, see javax.management.timer.Timer (which can be initialized/destroyed by a ServletContextListener). The idea is that you can schedule asynchronous operations but leave the Threads to be managed by the server.

Bill


Mitja Lustrek wrote:
Hello!
 
I want to write a web service that monitors a number of websites for changes. Upon request it sends a digest of the changes to a client. The way I intend to do it is to create a web service with scope 'application' in which a thread will run continuosly to do the monitoring. This may very well be a stupid way to do it (I'm rather inexperienced regarding the whole web services business), in which case advice on how to do it better is welcome. But even if my way of doing this is fine, I have a problem: my web service starts only when one of its methods is first invoked. I want it to start immediately. Is there a way to do that? Thanks.
 
Mitja

Reply via email to