Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA21BF5C5 for ; Fri, 12 Apr 2013 10:54:44 +0000 (UTC) Received: (qmail 35328 invoked by uid 500); 12 Apr 2013 10:54:43 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 34983 invoked by uid 500); 12 Apr 2013 10:54:38 -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 34952 invoked by uid 99); 12 Apr 2013 10:54:37 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Apr 2013 10:54:37 +0000 Received: from localhost (HELO fc18x64v0.jboss.hr) (127.0.0.1) (smtp-auth username mturk, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Apr 2013 10:54:37 +0000 Message-ID: <5167E7EA.3050906@apache.org> Date: Fri, 12 Apr 2013 12:54:34 +0200 From: Mladen Turk User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 MIME-Version: 1.0 To: user@commons.apache.org Subject: Re: [daemon] Stop and force-stop with jsvc References: <515B01B7.3010909@apache.org> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 04/11/2013 07:08 PM, Olivier Lemasle wrote: > Thanks for your help! > Sure. BTW, on second thought perhaps the best solution would be to call signal followed by stop. Signal method could set the flag for stop method making it "force-stop". Think this would be safest method, cause signal() alone causing shutdown could lead to auto restart. > > On Tue, Apr 2, 2013 at 6:05 PM, Mladen Turk wrote: > >>> >>> I'm using Apache Commons Daemon and jsvc to run my Java program as a >>> daemon >>> on GNU/Linux, using Daemon interface. >>> >>> I'd like to have two "stop" actions: >>> - a simple "stop" which cancels new tasks and waits for the completion of >>> active tasks on my application, and then stops; >>> - a "force-stop", which cancels new tasks, interrupts the active tasks, >>> and stops. >>> >>> Is there a way to do this with Jsvc? When I use "jsvc -stop ...", the >>> method stop() in my class implementing the Daemon interface is called, and >>> I have no choice to "force-stop". Could you please suggest a way to solve >>> my issue? >>> >>> >> You can implement user signal (SIGUSR2) interface which will call signal() >> method >> and there you can do what you wish. But I didn't tried to stop the JVM. >> Regards -- ^TM --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org