curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Qiu <>
Subject How does CuratorFramework handle connection losses?
Date Wed, 22 Mar 2017 17:30:56 GMT

Several questions:

1. The CuratorFramework documentation
<> says that "should share one
CuratorFramework per ZooKeeper cluster in your application". I create an
instance and call CuratorFramework#start() on application startup and reuse
the same instance throughout the lifetime of my application, but I never
call CuratorFramework#close(). Is this bad practice? What happens if my
application periodically killed and restarted?

2. If I acquire an InterProcessMutex and my application is killed before I
call InterProcessMutex#release(), what happens? Based on my experiments
with TestingServer, it seems that after DEFAULT_SESSION_TIMEOUT_MS
other applications are able to acquire the InterProcessMutex with the same
lock path. So there might be temporary starvation, but no deadlock. Is my
understanding correct?

3. I did a quick experiment where I pulled out my ethernet cable (lost
connection to the remote ZK cluster), waited several minutes, and then
inserted my ethernet cable in again. I observed from
ConnectionStateListener that the state will change to SUSPENDED, then LOST,
and when the ethernet cable is inserted again, RECONNECTED. How long does
it take for each state change to happen? Even if I lose connection for a
long period of time, can I trust that CuratorFramework will always handle

Any help, even if it's on a subset of these questions, would be really


View raw message