curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Zimmerman <>
Subject Re: Correct way to use InterProcessMutex and ConnectionStateListener
Date Fri, 14 Mar 2014 14:30:12 GMT
A few things:

* It’s overkill to use a read/write lock to store the connection state. Just use an AtomicReference

* You’re using InterProcesMutex correctly from what I can see. 

* While running method1()/method2() etc. periodically check the connect state. If it’s not
CONNECTED or RECONNECTED exit whatever you’re doing and try to acquire the lock again. Alternatively,
CuratorManager can keep track of threads that are using Curator objects and interrupt them
when there is a connection problem.


From: Drew Kutcharian
Date: March 13, 2014 at 6:33:06 PM
Subject:  Correct way to use InterProcessMutex and ConnectionStateListener  

Hi Guys,

I’m pretty new to Curator and I’m still trying to figure out how to use ConnectionStateListener.
Mainly, how can I combine an InterProcessMutex and a ConnectionStateListener. As an example,
what’s the correct way to user an InterProcessMutex and ConnectionStateListener in the following
use case:


View raw message