commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Haskin <de...@haskinferguson.net>
Subject signals in a Daemon?
Date Wed, 10 Mar 2010 19:07:40 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message