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(org.apache.curator.framework.CuratorFramework client, String basePath, boolean recursive)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Remove the watcher
    org.apache.curator.framework.listen.Listenable<org.apache.zookeeper.Watcher>
    Container for setting listeners
    org.apache.curator.framework.listen.Listenable<Runnable>
    Listeners are called when the persistent watcher has been successfully registered or re-registered after a connection disruption
    void
    Start watching

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PersistentWatcher

      public PersistentWatcher(org.apache.curator.framework.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 org.apache.curator.framework.listen.Listenable<org.apache.zookeeper.Watcher> getListenable()
      Container for setting listeners
      Returns:
      listener container
    • getResetListenable

      public org.apache.curator.framework.listen.Listenable<Runnable> getResetListenable()
      Listeners are called when the persistent watcher has been successfully registered or re-registered after a connection disruption
      Returns:
      listener container