Class PersistentWatcher
- java.lang.Object
-
- org.apache.curator.framework.recipes.watch.PersistentWatcher
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class PersistentWatcher extends Object implements Closeable
A managed persistent watcher. The watch will be managed such that it stays set through connection lapses, etc.
-
-
Constructor Summary
Constructors Constructor Description PersistentWatcher(CuratorFramework client, String basePath, boolean recursive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Remove the watcherListenable<org.apache.zookeeper.Watcher>
getListenable()
Container for setting listenersListenable<Runnable>
getResetListenable()
Listeners are called when the persistent watcher has been successfully registered or re-registered after a connection disruptionvoid
start()
Start watching
-
-
-
Constructor Detail
-
PersistentWatcher
public PersistentWatcher(CuratorFramework client, String basePath, boolean recursive)
- Parameters:
client
- clientbasePath
- path to set the watch onrecursive
- ZooKeeper persistent watches can optionally be recursive
-
-
Method Detail
-
start
public void start()
Start watching
-
close
public void close()
Remove the watcher- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getListenable
public Listenable<org.apache.zookeeper.Watcher> getListenable()
Container for setting listeners- Returns:
- listener container
-
getResetListenable
public Listenable<Runnable> getResetListenable()
Listeners are called when the persistent watcher has been successfully registered or re-registered after a connection disruption- Returns:
- listener container
-
-