Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 97940 invoked from network); 11 Mar 2010 01:53:48 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Mar 2010 01:53:48 -0000 Received: (qmail 99841 invoked by uid 500); 11 Mar 2010 01:53:15 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 99726 invoked by uid 500); 11 Mar 2010 01:53:15 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 99717 invoked by uid 99); 11 Mar 2010 01:53:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Mar 2010 01:53:14 +0000 X-ASF-Spam-Status: No, hits=2.9 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [74.125.82.171] (HELO mail-wy0-f171.google.com) (74.125.82.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Mar 2010 01:53:07 +0000 Received: by wyb35 with SMTP id 35so6644wyb.30 for ; Wed, 10 Mar 2010 17:52:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.88.68 with SMTP id z46mr248422wee.215.1268272366517; Wed, 10 Mar 2010 17:52:46 -0800 (PST) X-Originating-IP: [72.93.80.172] In-Reply-To: <4B981460.5080708@trustcommerce.com> References: <4B981460.5080708@trustcommerce.com> Date: Wed, 10 Mar 2010 20:52:46 -0500 Message-ID: Subject: Re: signals in a Daemon? From: Denis Haskin To: Commons Users List Content-Type: multipart/alternative; boundary=0016e6daa82be27dbb04817cab9a X-Virus-Checked: Checked by ClamAV on apache.org --0016e6daa82be27dbb04817cab9a Content-Type: text/plain; charset=ISO-8859-1 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 > > --0016e6daa82be27dbb04817cab9a--