Package com.mapr.fs
Class ServiceWatcher
java.lang.Object
com.mapr.fs.ServiceWatcher
- All Implemented Interfaces:
AutoCloseable,org.apache.zookeeper.Watcher
- Direct Known Subclasses:
QueryServiceWatcher
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
org.apache.zookeeper.Watcher.Event, org.apache.zookeeper.Watcher.WatcherType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intbytesToInt(byte[] data) voidclose()booleanconnect()protected Stringcreate(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode) protected Voidprotected BooleangetChildren(String nodePath) protected byte[]Retrieve the data stored in the specified ZooKeeper node specified by `primaryPath`.protected Integerprotected byte[]intToBytes(int newValue) booleanvoidprocess(org.apache.zookeeper.WatchedEvent event) booleanprotected org.apache.zookeeper.data.StatsetData(ServiceWatcher.ZkNode zkNode)
-
Constructor Details
-
ServiceWatcher
-
-
Method Details
-
getZKString
-
isConnected
public boolean isConnected() -
connect
public boolean connect() -
reconnect
public boolean reconnect() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
process
public void process(org.apache.zookeeper.WatchedEvent event) - Specified by:
processin interfaceorg.apache.zookeeper.Watcher
-
getData
protected byte[] getData(String nodePath) throws InterruptedException, org.apache.zookeeper.KeeperException, RetryException, FileNotFoundException, 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 fromnodePaths- Array of alternate paths to try- Returns:
- binary data stored in the ZooKeeper node.
- Throws:
RetryException- if a retry-able exception occursFileNotFoundException- if none of the specified nodes existIOException- if a non-retry-able exception occursInterruptedExceptionorg.apache.zookeeper.KeeperException.ConnectionLossExceptionorg.apache.zookeeper.KeeperException.SessionExpiredExceptionorg.apache.zookeeper.KeeperException.SessionMovedExceptionorg.apache.zookeeper.KeeperException
-
setData
protected org.apache.zookeeper.data.Stat setData(ServiceWatcher.ZkNode zkNode) throws InterruptedException, org.apache.zookeeper.KeeperException, RetryException, FileNotFoundException, IOException - Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionRetryExceptionFileNotFoundExceptionIOException
-
increment
protected Integer increment(String nodePath) throws IllegalFormatException, InterruptedException, org.apache.zookeeper.KeeperException, IOException - Throws:
IllegalFormatExceptionInterruptedExceptionorg.apache.zookeeper.KeeperExceptionIOException
-
bytesToInt
-
intToBytes
protected byte[] intToBytes(int newValue) -
exist
protected Boolean exist(String nodePath) throws InterruptedException, org.apache.zookeeper.KeeperException, RetryException, FileNotFoundException, IOException - Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionRetryExceptionFileNotFoundExceptionIOException
-
delete
protected Void delete(String path) throws InterruptedException, org.apache.zookeeper.KeeperException, RetryException, FileNotFoundException, IOException - Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionRetryExceptionFileNotFoundExceptionIOException
-
create
protected String create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode) throws InterruptedException, org.apache.zookeeper.KeeperException, RetryException, FileNotFoundException, IOException - Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionRetryExceptionFileNotFoundExceptionIOException
-
getChildren
protected List<String> getChildren(String nodePath) throws RetryException, FileNotFoundException, IOException, InterruptedException, org.apache.zookeeper.KeeperException - Throws:
RetryExceptionFileNotFoundExceptionIOExceptionInterruptedExceptionorg.apache.zookeeper.KeeperException
-