-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vance,

On 5/18/12 12:14 PM, Vance - wrote:
> I'm maintaining a Web application for searching multiple wikis,
> this app runs under Tomcat 6. I need to modify a servlet so it
> instantiates a 'Thread' subclass to perform a wiki availability
> check every so often, say every 30 minutes.

Suggestion: use a ServletContextListener, not a Servlet. Remember to
terminate the thread in the destroy() method. Note that terminating a
thread basically requires that you be able to communicate with the
thread to tell it to shut down (i.e. don't call Thread.stop()): you
need to have a Runnable that can be interrupted (using interrupt())
and also knows that the interrupt needs to be terminal... so set a
"shutdown" flag or something like that.

> Given that I'm no expert on the use of threads, a co-worker
> suggested the following questions to look into:
> 
> ·         Does the spawned thread have a time limit imposed by
> Tomcat?

No.

> ·         Does it take up worker thread space from other Tomcat
> threads?

No.

Your thread will take up RAM and CPU time of course. Also, processes
have thread limits and your thread will count against that.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+2dsYACgkQ9CaO5/Lv0PBT8ACgnUwG5KjDzTf9SYHtEM9iaYxJ
dy8An1vGhmAjMhzgpvfXGVNMkDlQTPzA
=nH91
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to