Class ZooKeeperRetry
java.lang.Object
org.apache.zookeeper.ZooKeeper
org.apache.zookeeper.retry.ZooKeeperRetry
- All Implemented Interfaces:
AutoCloseable
A Class which extends
ZooKeeper and will automatically retry calls to
zookeeper if a KeeperException.ConnectionLossException occurs.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.zookeeper.ZooKeeper
ZooKeeper.States, ZooKeeper.WatchRegistration -
Field Summary
Fields inherited from class org.apache.zookeeper.ZooKeeper
cnxn, hostProvider, SECURE_CLIENT, ZOOKEEPER_CLIENT_CNXN_SOCKET -
Constructor Summary
ConstructorsConstructorDescriptionZooKeeperRetry(String connectString, int sessionTimeout, Watcher watcher) ZooKeeperRetry(String connectString, int sessionTimeout, Watcher watcher, long sessionId, byte[] sessionPasswd) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, CreateMode createMode) voidorg.apache.zookeeper.data.Statorg.apache.zookeeper.data.StatList<org.apache.zookeeper.data.ACL> getChildren(String path, boolean watch) getChildren(String path, Watcher watcher) byte[]byte[]org.apache.zookeeper.data.Statorg.apache.zookeeper.data.StatvoidsetRetryLimit(int limit) booleanMethods inherited from class org.apache.zookeeper.ZooKeeper
addAuthInfo, addWatch, addWatch, addWatch, addWatch, close, create, create, create, create, create, delete, exists, exists, getACL, getAllChildrenNumber, getAllChildrenNumber, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getChildWatches, getClientConfig, getConfig, getConfig, getConfig, getConfig, getData, getData, getDataWatches, getEphemerals, getEphemerals, getEphemerals, getEphemerals, getExistWatches, getPersistentRecursiveWatches, getPersistentWatches, getSaslClient, getSessionId, getSessionPasswd, getSessionTimeout, getState, getTestable, multi, multi, multiInternal, multiInternal, register, removeAllWatches, removeAllWatches, removeWatches, removeWatches, setACL, setData, sync, sync, testableLocalSocketAddress, testableRemoteSocketAddress, testableWaitForShutdown, toString, transaction, updateServerList, whoAmI
-
Constructor Details
-
ZooKeeperRetry
- Parameters:
connectString-sessionTimeout-watcher-- Throws:
IOException
-
ZooKeeperRetry
public ZooKeeperRetry(String connectString, int sessionTimeout, Watcher watcher, long sessionId, byte[] sessionPasswd) throws IOException - Parameters:
connectString-sessionTimeout-watcher-sessionId-sessionPasswd-- Throws:
IOException
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classZooKeeper- Throws:
InterruptedException
-
create
public String create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, CreateMode createMode) throws KeeperException, InterruptedException - Overrides:
createin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
delete
- Overrides:
deletein classZooKeeper- Throws:
InterruptedExceptionKeeperException
-
exists
public org.apache.zookeeper.data.Stat exists(String path, boolean watch) throws KeeperException, InterruptedException - Overrides:
existsin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
exists
public org.apache.zookeeper.data.Stat exists(String path, Watcher watcher) throws KeeperException, InterruptedException - Overrides:
existsin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getACL
public List<org.apache.zookeeper.data.ACL> getACL(String path, org.apache.zookeeper.data.Stat stat) throws KeeperException, InterruptedException - Overrides:
getACLin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getChildren
public List<String> getChildren(String path, boolean watch) throws KeeperException, InterruptedException - Overrides:
getChildrenin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getChildren
public List<String> getChildren(String path, Watcher watcher) throws KeeperException, InterruptedException - Overrides:
getChildrenin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getData
public byte[] getData(String path, boolean watch, org.apache.zookeeper.data.Stat stat) throws KeeperException, InterruptedException - Overrides:
getDatain classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getData
public byte[] getData(String path, Watcher watcher, org.apache.zookeeper.data.Stat stat) throws KeeperException, InterruptedException - Overrides:
getDatain classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
setACL
public org.apache.zookeeper.data.Stat setACL(String path, List<org.apache.zookeeper.data.ACL> acl, int aclVersion) throws KeeperException, InterruptedException - Overrides:
setACLin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
setData
public org.apache.zookeeper.data.Stat setData(String path, byte[] data, int version) throws KeeperException, InterruptedException - Overrides:
setDatain classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
setRetryLimit
public void setRetryLimit(int limit) - Parameters:
limit-
-
testConnection
public boolean testConnection()- Returns:
- true if successfully connected to zookeeper
-