curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Littlejohn <>
Subject Cleanly closing down a LeaderLatch
Date Mon, 06 Jun 2016 13:45:37 GMT

When I stop an app that is using a LeaderLatch, I'd like to close the latch
itself and also close the underlying CuratorFramework. What's the best way
to do this?

When I close the latch and immediately close the CuratorFramework, I see
exceptions like:

java.lang.IllegalStateException: Client is not started


java.lang.IllegalStateException: instance must be started before calling
this method at at

Which I believe is caused by some background updates that are scheduled
when the latch closes. Is there any way to close the CuratorFramework only
after all background tasks are complete? Ideally I'd like to avoid having
to use Thread.sleep(1000) :)

Maybe there's something else I should do to wait for all latch updates to
complete before considering the latch 'closed'?


View raw message