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

Nathan,

[EMAIL PROTECTED] wrote:
> In my code, I have a ServletContextListener (configured in web.xml or
> similar file, don't remember exactly), so when the servlet context is
> created it calls contextInitialized(ServletContextEvent).  In this
> function I start the daemon threads.  There is a function
> contextDestroyed which you can use to stop the threads (but note
> Thread.stop is deprecated).

Yup, that'll work. If you subclass Thread (or, better yet, Runnable),
you can add a method that tells the process to stop itself: basically,
you set a flag that your long-running loop (or whatever) periodically
checks to see if it's been set. If it's been set, you simply return from
the "run" method and the thread stops. This is much better than calling
Thread.stop().

> It sounds like a good idea to start these background threads in a new
> process.  However, I don't know if you can do this in a hosted web
> server environment like the kind you find at mochahost.com and
> dailyrazor.com.  Will need to test it out.

Yeah, you'll need to see what they allow you to do. cron is, of course,
the best choice if it's available. Otherwise, you may have to run your
process from within your web application. :(

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkkIcEACgkQ9CaO5/Lv0PChigCaAhi4PtzdVngSBdAZ4aRiq8IS
c/IAoIaNVjkBxa8Z9MUpwQxEEsGysHcc
=GttZ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to