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 Details

    • PersistentWatcher

      public PersistentWatcher(CuratorFramework client, String basePath, boolean recursive)
      Parameters:
      client - client
      basePath - path to set the watch on
      recursive - ZooKeeper persistent watches can optionally be recursive
  • Method Details

    • start

      public void start()
      Start watching
    • close

      public void close()
      Remove the watcher
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • 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