Package com.mapr.fs

Class ServiceWatcher

  • All Implemented Interfaces:
    org.apache.zookeeper.Watcher
    Direct Known Subclasses:
    QueryServiceWatcher

    public class ServiceWatcher
    extends java.lang.Object
    implements org.apache.zookeeper.Watcher
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher

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

      Constructors 
      Constructor Description
      ServiceWatcher​(java.lang.String zkConnectString, java.lang.String clusterName)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean connect()  
      protected java.lang.String create​(java.lang.String path, byte[] data, java.util.List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode)  
      protected java.lang.Void delete​(java.lang.String path)  
      protected java.util.List<java.lang.String> getChildren​(java.lang.String nodePath)  
      protected byte[] getData​(java.lang.String nodePath)
      Retrieve the data stored in the specified ZooKeeper node specified by `primaryPath`.
      java.lang.String getZKString()  
      boolean isConnected()  
      void process​(org.apache.zookeeper.WatchedEvent event)  
      boolean reconnect()  
      • Methods inherited from class java.lang.Object

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

      • ServiceWatcher

        public ServiceWatcher​(java.lang.String zkConnectString,
                              java.lang.String clusterName)
    • Method Detail

      • getZKString

        public java.lang.String getZKString()
      • isConnected

        public boolean isConnected()
      • connect

        public boolean connect()
      • reconnect

        public boolean reconnect()
      • close

        public void close()
      • process

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

        protected byte[] getData​(java.lang.String nodePath)
                          throws java.lang.InterruptedException,
                                 org.apache.zookeeper.KeeperException,
                                 RetryException,
                                 java.io.FileNotFoundException,
                                 java.io.IOException
        Retrieve the data stored in the specified ZooKeeper node specified by `primaryPath`. If the `primaryPath` does not exist, try the other paths if provided, in the order they are provided
        Parameters:
        primaryPath - The primary ZooKeeper node path from which to read data from
        nodePaths - Array of alternate paths to try
        Returns:
        binary data stored in the ZooKeeper node.
        Throws:
        RetryException - if a retry-able exception occurs
        java.io.FileNotFoundException - if none of the specified nodes exist
        java.io.IOException - if a non-retry-able exception occurs
        java.lang.InterruptedException
        org.apache.zookeeper.KeeperException.ConnectionLossException
        org.apache.zookeeper.KeeperException.SessionExpiredException
        org.apache.zookeeper.KeeperException.SessionMovedException
        org.apache.zookeeper.KeeperException
      • delete

        protected java.lang.Void delete​(java.lang.String path)
                                 throws java.lang.InterruptedException,
                                        org.apache.zookeeper.KeeperException,
                                        RetryException,
                                        java.io.FileNotFoundException,
                                        java.io.IOException
        Throws:
        java.lang.InterruptedException
        org.apache.zookeeper.KeeperException
        RetryException
        java.io.FileNotFoundException
        java.io.IOException
      • create

        protected java.lang.String create​(java.lang.String path,
                                          byte[] data,
                                          java.util.List<org.apache.zookeeper.data.ACL> acl,
                                          org.apache.zookeeper.CreateMode createMode)
                                   throws java.lang.InterruptedException,
                                          org.apache.zookeeper.KeeperException,
                                          RetryException,
                                          java.io.FileNotFoundException,
                                          java.io.IOException
        Throws:
        java.lang.InterruptedException
        org.apache.zookeeper.KeeperException
        RetryException
        java.io.FileNotFoundException
        java.io.IOException
      • getChildren

        protected java.util.List<java.lang.String> getChildren​(java.lang.String nodePath)
                                                        throws RetryException,
                                                               java.io.FileNotFoundException,
                                                               java.io.IOException,
                                                               java.lang.InterruptedException,
                                                               org.apache.zookeeper.KeeperException
        Throws:
        RetryException
        java.io.FileNotFoundException
        java.io.IOException
        java.lang.InterruptedException
        org.apache.zookeeper.KeeperException