karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: Proposal: New Lock for failing Karaf start if running
Date Wed, 02 Dec 2015 09:15:22 GMT
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

Mime
View raw message