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

Reply via email to