Class AbstractZookeeperClient<TargetDataListener,TargetChildListener>
java.lang.Object
org.apache.dubbo.remoting.zookeeper.AbstractZookeeperClient<TargetDataListener,TargetChildListener>
- All Implemented Interfaces:
ZookeeperClient
public abstract class AbstractZookeeperClient<TargetDataListener,TargetChildListener>
extends Object
implements ZookeeperClient
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddChildListener(String path, ChildListener listener) voidaddDataListener(String path, DataListener listener) Attach data listener to current Zookeeper client.voidaddDataListener(String path, DataListener listener, Executor executor) Attach data listener to current Zookeeper client.voidaddStateListener(StateListener listener) abstract booleancheckExists(String path) voidclose()Close connection to Zookeeper server (cluster).voidCreate ZNode in Zookeeper.voidcreateOrUpdate(String path, String content, boolean ephemeral) Create or update ZNode in Zookeeper with content specified.voidcreateOrUpdate(String path, String content, boolean ephemeral, Integer version) CAS version to Create or update ZNode in Zookeeper with content specified.voidDelete ZNode.getConfigItem(String path) getContent(String path) Obtain the content of a ZNode.getUrl()voidremoveChildListener(String path, ChildListener listener) voidremoveDataListener(String path, DataListener listener) Detach data listener.voidremoveStateListener(StateListener listener) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.dubbo.remoting.zookeeper.ZookeeperClient
getChildren, isConnected
-
Constructor Details
-
AbstractZookeeperClient
-
-
Method Details
-
getUrl
- Specified by:
getUrlin interfaceZookeeperClient
-
delete
Description copied from interface:ZookeeperClientDelete ZNode.- Specified by:
deletein interfaceZookeeperClient- Parameters:
path- path to ZNode
-
create
Description copied from interface:ZookeeperClientCreate ZNode in Zookeeper.- Specified by:
createin interfaceZookeeperClient- Parameters:
path- path to ZNodeephemeral- specify create mode of ZNode creation. true - EPHEMERAL, false - PERSISTENT.faultTolerant- specify fault tolerance of ZNode creation. true - ignore exception and recreate if is ephemeral, false - throw exception.
-
addStateListener
- Specified by:
addStateListenerin interfaceZookeeperClient
-
removeStateListener
- Specified by:
removeStateListenerin interfaceZookeeperClient
-
getSessionListeners
-
addChildListener
- Specified by:
addChildListenerin interfaceZookeeperClient
-
addDataListener
Description copied from interface:ZookeeperClientAttach data listener to current Zookeeper client.- Specified by:
addDataListenerin interfaceZookeeperClient- Parameters:
path- directory. All children of path will be listened.listener- The data listener object.
-
addDataListener
Description copied from interface:ZookeeperClientAttach data listener to current Zookeeper client. The listener will be executed using the given executor.- Specified by:
addDataListenerin interfaceZookeeperClient- Parameters:
path- directory. All children of path will be listened.listener- The data listener object.executor- the executor that will execute the listener.
-
removeDataListener
Description copied from interface:ZookeeperClientDetach data listener.- Specified by:
removeDataListenerin interfaceZookeeperClient- Parameters:
path- directory. All listener of children of the path will be detached.listener- The data listener object.
-
removeChildListener
- Specified by:
removeChildListenerin interfaceZookeeperClient
-
close
public void close()Description copied from interface:ZookeeperClientClose connection to Zookeeper server (cluster).- Specified by:
closein interfaceZookeeperClient
-
createOrUpdate
Description copied from interface:ZookeeperClientCreate or update ZNode in Zookeeper with content specified.- Specified by:
createOrUpdatein interfaceZookeeperClient- Parameters:
path- path to ZNodecontent- the content of ZNodeephemeral- specify create mode of ZNode creation. true - EPHEMERAL, false - PERSISTENT.
-
createOrUpdate
Description copied from interface:ZookeeperClientCAS version to Create or update ZNode in Zookeeper with content specified.- Specified by:
createOrUpdatein interfaceZookeeperClient- Parameters:
path- path to ZNodecontent- the content of ZNodeephemeral- specify create mode of ZNode creation. true - EPHEMERAL, false - PERSISTENT.version- origin content version, if current version is not the specified version, throw exception
-
getContent
Description copied from interface:ZookeeperClientObtain the content of a ZNode.- Specified by:
getContentin interfaceZookeeperClient- Parameters:
path- path to ZNode- Returns:
- content of ZNode
-
getConfigItem
- Specified by:
getConfigItemin interfaceZookeeperClient
-
checkExists
- Specified by:
checkExistsin interfaceZookeeperClient
-