Package com.networknt.zookeeper.client
Class ZooKeeperClientImpl
- java.lang.Object
-
- com.networknt.zookeeper.client.ZooKeeperClientImpl
-
- All Implemented Interfaces:
ZooKeeperClient
public class ZooKeeperClientImpl extends Object implements ZooKeeperClient
ZooKeeperClient implementation.- Author:
- Steve Hu
-
-
Constructor Summary
Constructors Constructor Description ZooKeeperClientImpl(String zkServers, int sessionTimeout, int connectionTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateEphemeral(String path, Object data)voidcreatePersistent(String path, boolean createParents)booleandelete(String path)booleanexists(String path)List<String>getChildren(String path)intgetConnectionTimeout()intgetSessionTimeout()StringgetZkServers()<T> TreadData(String path)<T> TreadData(String path, boolean returnNullIfPathNotExists)voidsetConnectionTimeout(int connectionTimeout)voidsetSessionTimeout(int sessionTimeout)voidsetZkServers(String zkServers)List<String>subscribeChildChanges(String path, org.I0Itec.zkclient.IZkChildListener listener)voidsubscribeDataChanges(String path, org.I0Itec.zkclient.IZkDataListener listener)voidsubscribeStateChanges(org.I0Itec.zkclient.IZkStateListener listener)voidunsubscribeChildChanges(String path, org.I0Itec.zkclient.IZkChildListener childListener)voidunsubscribeDataChanges(String path, org.I0Itec.zkclient.IZkDataListener dataListener)voidwriteData(String path, Object object)
-
-
-
Constructor Detail
-
ZooKeeperClientImpl
public ZooKeeperClientImpl(String zkServers, int sessionTimeout, int connectionTimeout)
-
-
Method Detail
-
getZkServers
public String getZkServers()
-
setZkServers
public void setZkServers(String zkServers)
-
getSessionTimeout
public int getSessionTimeout()
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout)
-
getConnectionTimeout
public int getConnectionTimeout()
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
-
subscribeStateChanges
public void subscribeStateChanges(org.I0Itec.zkclient.IZkStateListener listener)
- Specified by:
subscribeStateChangesin interfaceZooKeeperClient
-
subscribeChildChanges
public List<String> subscribeChildChanges(String path, org.I0Itec.zkclient.IZkChildListener listener)
- Specified by:
subscribeChildChangesin interfaceZooKeeperClient
-
unsubscribeChildChanges
public void unsubscribeChildChanges(String path, org.I0Itec.zkclient.IZkChildListener childListener)
- Specified by:
unsubscribeChildChangesin interfaceZooKeeperClient
-
subscribeDataChanges
public void subscribeDataChanges(String path, org.I0Itec.zkclient.IZkDataListener listener)
- Specified by:
subscribeDataChangesin interfaceZooKeeperClient
-
unsubscribeDataChanges
public void unsubscribeDataChanges(String path, org.I0Itec.zkclient.IZkDataListener dataListener)
- Specified by:
unsubscribeDataChangesin interfaceZooKeeperClient
-
exists
public boolean exists(String path)
- Specified by:
existsin interfaceZooKeeperClient
-
getChildren
public List<String> getChildren(String path)
- Specified by:
getChildrenin interfaceZooKeeperClient
-
readData
public <T> T readData(String path)
- Specified by:
readDatain interfaceZooKeeperClient
-
readData
public <T> T readData(String path, boolean returnNullIfPathNotExists)
- Specified by:
readDatain interfaceZooKeeperClient
-
writeData
public void writeData(String path, Object object)
- Specified by:
writeDatain interfaceZooKeeperClient
-
createPersistent
public void createPersistent(String path, boolean createParents) throws org.I0Itec.zkclient.exception.ZkInterruptedException, IllegalArgumentException, org.I0Itec.zkclient.exception.ZkException, RuntimeException
- Specified by:
createPersistentin interfaceZooKeeperClient- Throws:
org.I0Itec.zkclient.exception.ZkInterruptedExceptionIllegalArgumentExceptionorg.I0Itec.zkclient.exception.ZkExceptionRuntimeException
-
createEphemeral
public void createEphemeral(String path, Object data) throws org.I0Itec.zkclient.exception.ZkInterruptedException, IllegalArgumentException, org.I0Itec.zkclient.exception.ZkException, RuntimeException
- Specified by:
createEphemeralin interfaceZooKeeperClient- Throws:
org.I0Itec.zkclient.exception.ZkInterruptedExceptionIllegalArgumentExceptionorg.I0Itec.zkclient.exception.ZkExceptionRuntimeException
-
delete
public boolean delete(String path)
- Specified by:
deletein interfaceZooKeeperClient
-
-