commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Haskin <de...@haskinferguson.net>
Subject Re: signals in a Daemon?
Date Thu, 11 Mar 2010 01:52:46 GMT
Aha!  I was sort of musing out loud about that this morning to a co-worker,
but he just looked at me funny.  But from what you suggest I think I was on
the right track.

Thanks --

dwh


On Wed, Mar 10, 2010 at 4:51 PM, Johnny Luong <
johnny.luong@trustcommerce.com> wrote:

> -----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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message