Class ZooKeeperSessionWatcher

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Runnable, org.apache.zookeeper.AsyncCallback, org.apache.zookeeper.AsyncCallback.StatCallback, org.apache.zookeeper.Watcher

    public class ZooKeeperSessionWatcher
    extends java.lang.Object
    implements org.apache.zookeeper.Watcher, org.apache.zookeeper.AsyncCallback.StatCallback, java.lang.Runnable, java.io.Closeable
    A ZooKeeper watcher for the Pulsar instance. Monitor the ZK session state every few seconds. If the session is not in Connected state for a while, we will kill the process before the session is supposed to expire
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ZooKeeperSessionWatcher.ShutdownService  
      • Nested classes/interfaces inherited from interface org.apache.zookeeper.AsyncCallback

        org.apache.zookeeper.AsyncCallback.ACLCallback, org.apache.zookeeper.AsyncCallback.AllChildrenNumberCallback, org.apache.zookeeper.AsyncCallback.Children2Callback, org.apache.zookeeper.AsyncCallback.ChildrenCallback, org.apache.zookeeper.AsyncCallback.Create2Callback, org.apache.zookeeper.AsyncCallback.DataCallback, org.apache.zookeeper.AsyncCallback.EphemeralsCallback, org.apache.zookeeper.AsyncCallback.MultiCallback, org.apache.zookeeper.AsyncCallback.StatCallback, org.apache.zookeeper.AsyncCallback.StringCallback, org.apache.zookeeper.AsyncCallback.VoidCallback
      • Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher

        org.apache.zookeeper.Watcher.Event, org.apache.zookeeper.Watcher.WatcherType
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      org.apache.zookeeper.Watcher.Event.KeeperState getKeeperState()  
      boolean isShutdownStarted()  
      void process​(org.apache.zookeeper.WatchedEvent event)  
      void processResult​(int rc, java.lang.String path, java.lang.Object ctx, org.apache.zookeeper.data.Stat stat)  
      void run()  
      void start()  
      • Methods inherited from class java.lang.Object

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

      • ZooKeeperSessionWatcher

        public ZooKeeperSessionWatcher​(org.apache.zookeeper.ZooKeeper zk,
                                       long zkSessionTimeoutMillis,
                                       ZookeeperSessionExpiredHandler sessionExpiredHandler)
    • Method Detail

      • start

        public void start()
      • getKeeperState

        public org.apache.zookeeper.Watcher.Event.KeeperState getKeeperState()
      • isShutdownStarted

        public boolean isShutdownStarted()
      • process

        public void process​(org.apache.zookeeper.WatchedEvent event)
        Specified by:
        process in interface org.apache.zookeeper.Watcher
      • processResult

        public void processResult​(int rc,
                                  java.lang.String path,
                                  java.lang.Object ctx,
                                  org.apache.zookeeper.data.Stat stat)
        Specified by:
        processResult in interface org.apache.zookeeper.AsyncCallback.StatCallback
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable