commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johnny Luong <johnny.lu...@trustcommerce.com>
Subject Re: signals in a Daemon?
Date Wed, 10 Mar 2010 21:51:28 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Denis Haskin wrote:
| Can someone shed some light here?
|
| I have a daemon implemented using commons daemon.  I've done it the
| recommend way, where the start() method of my daemon just fires off a
thread
| which does the actual work.
|
| What I find a little surprising is that when I send the daemon a TERM
| signal, the stop() method gets called (as expected), but it really seems
| like a TERM signal is also delivered to my thread, since it exits
abruptly.
|  Ideally, I would like to: in the stop() method, set a flag for the thread
| so that when it finishes its current chunk of work, it will exit.
|
| It seems like jsvc is (as would be expected) putting in its own signal
| handling, and that is preventing me from being able to trap this
signal and
| prevent my thread from exiting abruptly.
|
| Is this not recommended behavior?  Any recommendations how to do this?
|
| Thanks,
|
| dwh
|

Hi Denis,

Does your stop method wait till all daemon threads are finished
executing?  If it does not, and the only threads remaining are Daemon
threads, then the JVM is just going to exit which might make it appear
that it has abruptly exited...

Best,
Johnny
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkuYFGAACgkQg7TIS7A9isfPNgCgjtOJDIeB2IbLQB3T/tVr0Qae
+qkAoKJOdTxFiQV7mnR8SayNMR5GGDoz
=MHno
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message