karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabian Lange <fabian.la...@codecentric.de>
Subject Proposal: New Lock for failing Karaf start if running
Date Wed, 02 Dec 2015 08:32:16 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message