tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Extra Threads in background
Date Fri, 01 May 2009 16:32:02 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

On 4/28/2009 10:52 PM, David.Meldrum wrote:
> I need a background task which I implemented as a thread that I stated
> in the ContextListerner.

[snip]

> The problem I noticed is that while I only call
> the BackGroundThread.*start()* method once.  I see at least two threads
> running in Tomcat (las seen in Thread dump and looking at it in
> "Probe").

Are you re-deploying your application at all? If you are only starting
your thread, you will be starting a new thread for each deployment. So,
if you re-start your application, a second (or third, or fourth) will be
created.

Tomcat doesn't kill your application's threads when the app dies. You
need to end them yourself. Since you already have a ContextListener,
just add a destroy() method that shuts down the background thread.

Apologies if you're already doing this, but you didn't mention it and I
figure it's the most likely scenario.

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

iEYEARECAAYFAkn7JAIACgkQ9CaO5/Lv0PBQ/QCgq3ZlezGAiw8F9M9KiVG6lOjD
B8IAniSz5gk9WBZ97jS0pBjtxLp4IUlj
=hYDX
-----END PGP SIGNATURE-----

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


Mime
View raw message