Return-Path: X-Original-To: apmail-karaf-dev-archive@minotaur.apache.org Delivered-To: apmail-karaf-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F19D18E8C for ; Wed, 2 Dec 2015 16:22:35 +0000 (UTC) Received: (qmail 72836 invoked by uid 500); 2 Dec 2015 16:21:36 -0000 Delivered-To: apmail-karaf-dev-archive@karaf.apache.org Received: (qmail 72795 invoked by uid 500); 2 Dec 2015 16:21:36 -0000 Mailing-List: contact dev-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list dev@karaf.apache.org Received: (qmail 72784 invoked by uid 99); 2 Dec 2015 16:21:36 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2015 16:21:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D2E531A0AB1 for ; Wed, 2 Dec 2015 16:21:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.001 X-Spam-Level: * X-Spam-Status: No, score=1.001 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id eL8a_9V-Hpbp for ; Wed, 2 Dec 2015 16:21:26 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 1FA7621624 for ; Wed, 2 Dec 2015 16:21:26 +0000 (UTC) Received: from mfilter46-d.gandi.net (mfilter46-d.gandi.net [217.70.178.177]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 562681728E9 for ; Wed, 2 Dec 2015 17:21:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter46-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter46-d.gandi.net (mfilter46-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id ZW3XUXvaq6dV for ; Wed, 2 Dec 2015 17:21:18 +0100 (CET) X-Originating-IP: 82.238.224.4 Received: from [192.168.134.10] (bre91-1-82-238-224-4.fbx.proxad.net [82.238.224.4]) (Authenticated sender: jb@nanthrax.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id CD25B172A49 for ; Wed, 2 Dec 2015 17:21:16 +0100 (CET) Subject: Re: Proposal: New Lock for failing Karaf start if running To: dev@karaf.apache.org References: <565EB6AA.5040000@nanthrax.net> From: =?UTF-8?Q?Jean-Baptiste_Onofr=c3=a9?= Message-ID: <565F1A7C.1090201@nanthrax.net> Date: Wed, 2 Dec 2015 17:21:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hey Fabian, Do you mind if I create the Jira and try a hack ? Regards JB On 12/02/2015 05:18 PM, Fabian Lange wrote: > HI, > yes I understand the current solution. It is really nice. My request was > for a much simpler much more basic feature. > > karaf.lock.exclusive > > would probably be what I need. But I would not know how to implement that > > Fabian > > On Wed, Dec 2, 2015 at 10:15 AM, Jean-Baptiste Onofré > wrote: > >> Hi Fabian, >> >> the purpose is also to be able to "prepare" the slave instance, so the >> instance has to be started somehow. >> >> However, what you propose could make sense in some use case. Maybe we can >> add a karaf.lock.exclusive property to define this behavior. >> >> WDYT ? >> >> Regards >> JB >> >> >> On 12/02/2015 09:32 AM, Fabian Lange wrote: >> >>> Hi, >>> to my surprise I saw that while Karaf has a sweet failover mechanism, it >>> does not provide means to actually prevent startup of a second instance, >>> should the use case require it. >>> i can turn Lock off, but then I can start as many instances as I like >>> (which subsequently have bundle issues due to activators not able to bind >>> ports). >>> And I can wait for previous instances to terminate by using File or JDBC >>> lock. >>> In my case I want the second start to fail. >>> >>> Would it be sufficient to subclass SimpleFileLock, and to overwrite >>> >>> boolean lock() throws Exception { >>> boolean locked = super.lock(); >>> if (!locked) throw new RuntimeException("startup aborted"); >>> return true; >>> } >>> >>> or would that be not a great idea? >>> >>> if you think its useful I can make this nice and package as PR >>> >>> Fabian >>> >>> >> -- >> Jean-Baptiste Onofré >> jbonofre@apache.org >> http://blog.nanthrax.net >> Talend - http://www.talend.com >> > -- Jean-Baptiste Onofré jbonofre@apache.org http://blog.nanthrax.net Talend - http://www.talend.com