public abstract class AbstractZookeeperClient<TargetDataListener,TargetChildListener> extends Object implements ZookeeperClient
| 构造器和说明 |
|---|
AbstractZookeeperClient(URL url) |
| 限定符和类型 | 方法和说明 |
|---|---|
List<String> |
addChildListener(String path,
ChildListener listener) |
void |
addDataListener(String path,
DataListener listener)
Attach data listener to current Zookeeper client.
|
void |
addDataListener(String path,
DataListener listener,
Executor executor)
Attach data listener to current Zookeeper client.
|
void |
addStateListener(StateListener listener) |
abstract boolean |
checkExists(String path) |
void |
close()
Close connection to Zookeeper server (cluster).
|
void |
create(String path,
boolean ephemeral)
Create ZNode in Zookeeper.
|
void |
create(String path,
String content,
boolean ephemeral)
Create ZNode in Zookeeper with content specified.
|
void |
createOrUpdate(String path,
String content,
boolean ephemeral,
int version) |
void |
delete(String path)
Delete ZNode.
|
ConfigItem |
getConfigItem(String path) |
String |
getContent(String path)
Obtain the content of a ZNode.
|
Set<StateListener> |
getSessionListeners() |
URL |
getUrl() |
void |
removeChildListener(String path,
ChildListener listener) |
void |
removeDataListener(String path,
DataListener listener)
Detach data listener.
|
void |
removeStateListener(StateListener listener) |
getChildren, isConnectedpublic AbstractZookeeperClient(URL url)
public URL getUrl()
getUrl 在接口中 ZookeeperClientpublic void delete(String path)
ZookeeperClientdelete 在接口中 ZookeeperClientpath - path to ZNodepublic void create(String path, boolean ephemeral)
ZookeeperClientcreate 在接口中 ZookeeperClientpath - path to ZNodeephemeral - specify create mode of ZNode creation. true - EPHEMERAL, false - PERSISTENT.public void addStateListener(StateListener listener)
addStateListener 在接口中 ZookeeperClientpublic void removeStateListener(StateListener listener)
removeStateListener 在接口中 ZookeeperClientpublic Set<StateListener> getSessionListeners()
public List<String> addChildListener(String path, ChildListener listener)
addChildListener 在接口中 ZookeeperClientpublic void addDataListener(String path, DataListener listener)
ZookeeperClientaddDataListener 在接口中 ZookeeperClientpath - directory. All children of path will be listened.listener - The data listener object.public void addDataListener(String path, DataListener listener, Executor executor)
ZookeeperClientaddDataListener 在接口中 ZookeeperClientpath - directory. All children of path will be listened.listener - The data listener object.executor - the executor that will execute the listener.public void removeDataListener(String path, DataListener listener)
ZookeeperClientremoveDataListener 在接口中 ZookeeperClientpath - directory. All listener of children of the path will be detached.listener - The data listener object.public void removeChildListener(String path, ChildListener listener)
removeChildListener 在接口中 ZookeeperClientpublic void close()
ZookeeperClientclose 在接口中 ZookeeperClientpublic void create(String path, String content, boolean ephemeral)
ZookeeperClientcreate 在接口中 ZookeeperClientpath - path to ZNodecontent - the content of ZNodeephemeral - specify create mode of ZNode creation. true - EPHEMERAL, false - PERSISTENT.public void createOrUpdate(String path, String content, boolean ephemeral, int version)
createOrUpdate 在接口中 ZookeeperClientpublic String getContent(String path)
ZookeeperClientgetContent 在接口中 ZookeeperClientpath - path to ZNodepublic ConfigItem getConfigItem(String path)
getConfigItem 在接口中 ZookeeperClientpublic abstract boolean checkExists(String path)
checkExists 在接口中 ZookeeperClientCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.