public abstract class ForwardingZKClient extends AbstractZKClient
| Modifier | Constructor and Description |
|---|---|
protected |
ForwardingZKClient(ZKClient delegate) |
| Modifier and Type | Method and Description |
|---|---|
Cancellable |
addConnectionWatcher(org.apache.zookeeper.Watcher watcher)
Adds a
Watcher that will be called whenever connection state change. |
OperationFuture<String> |
create(String path,
byte[] data,
org.apache.zookeeper.CreateMode createMode,
boolean createParent,
Iterable<org.apache.zookeeper.data.ACL> acl)
Creates a path in zookeeper, with given data and create mode.
|
OperationFuture<String> |
delete(String deletePath,
int version)
Deletes the node of the given path that match the given version.
|
OperationFuture<org.apache.zookeeper.data.Stat> |
exists(String path,
org.apache.zookeeper.Watcher watcher)
Checks if the given path exists and leave a watcher on the node for watching creation/deletion/data changes
on the node.
|
OperationFuture<ACLData> |
getACL(String path)
Retrieves the Stat and ACL being set at the given path.
|
OperationFuture<NodeChildren> |
getChildren(String path,
org.apache.zookeeper.Watcher watcher)
Gets the list of children nodes under the given path and leave a watcher on the node for watching node
deletion and children nodes creation/deletion.
|
String |
getConnectString()
Returns the connection string used for connecting to Zookeeper.
|
OperationFuture<NodeData> |
getData(String path,
org.apache.zookeeper.Watcher watcher)
Gets the data stored in the given path and leave a watcher on the node for watching deletion/data changes on
the node.
|
ZKClient |
getDelegate() |
Long |
getSessionId()
Returns the current Zookeeper session ID of this client.
|
OperationFuture<org.apache.zookeeper.data.Stat> |
setACL(String path,
Iterable<org.apache.zookeeper.data.ACL> acl,
int version)
Sets the ACL of the given path if the path exists and version matched.
|
OperationFuture<org.apache.zookeeper.data.Stat> |
setData(String dataPath,
byte[] data,
int version)
Sets the data for the given path that match the given version.
|
create, create, create, delete, exists, getChildren, getData, setACL, setDataprotected ForwardingZKClient(ZKClient delegate)
public final ZKClient getDelegate()
public Long getSessionId()
ZKClientnull is returned.public String getConnectString()
ZKClientpublic Cancellable addConnectionWatcher(org.apache.zookeeper.Watcher watcher)
ZKClientWatcher that will be called whenever connection state change.watcher - The watcher to set.Cancellable for removing the watcherpublic OperationFuture<String> create(String path, @Nullable byte[] data, org.apache.zookeeper.CreateMode createMode, boolean createParent, Iterable<org.apache.zookeeper.data.ACL> acl)
ZKClientpath - Path to be createddata - Data to be stored in the node, or null if no data to store.createMode - The CreateMode for the node.createParent - If true and parent nodes are missing, it will create all parent nodes as normal
persistent node with the ACL ZooDefs.Ids.OPEN_ACL_UNSAFE
before creating the request node.acl - Set of ACL to be set for the node being created.OperationFuture that will be completed when the
creation is done. If there is error during creation, it will be reflected as error in the future.public OperationFuture<org.apache.zookeeper.data.Stat> exists(String path, @Nullable org.apache.zookeeper.Watcher watcher)
ZKClientpath - The path to check for existence.watcher - Watcher for watching changes, or null if no watcher to set.OperationFuture that will be completed when the exists check is done. If the path
does exists, the node Stat is set into the future. If the path doesn't exists,
a null value is set into the future.public OperationFuture<NodeChildren> getChildren(String path, @Nullable org.apache.zookeeper.Watcher watcher)
ZKClientpath - The path to fetch for children nodeswatcher - Watcher for watching changes, or null if no watcher to set.OperationFuture that will be completed when the getChildren call is done, with the result
given as NodeChildren. If there is error, it will be reflected as error in the future.public OperationFuture<NodeData> getData(String path, @Nullable org.apache.zookeeper.Watcher watcher)
ZKClientpath - The path to get data from.watcher - Watcher for watching changes, or null if no watcher to set.OperationFuture that will be completed when the getData call is done, with the result
given as NodeData. If there is error, it will be reflected as error in the future.public OperationFuture<org.apache.zookeeper.data.Stat> setData(String dataPath, byte[] data, int version)
ZKClient-1, it matches
any version.dataPath - The path to set data to.data - Data to be set.version - Matching version.OperationFuture that will be completed when the setData call is done, with node Stat
given as the future result. If there is error, it will be reflected as error in the future.public OperationFuture<String> delete(String deletePath, int version)
ZKClient-1, it matches
any version.deletePath - The path to set data to.version - Matching version.OperationFuture that will be completed when the setData call is done, with node path
given as the future result. If there is error, it will be reflected as error in the future.public OperationFuture<ACLData> getACL(String path)
ZKClientpath - The path to get information from.OperationFuture that will be completed when the getACL call is done, with the result given as
ACLData. If there is error, it will be reflected as error in the future.public OperationFuture<org.apache.zookeeper.data.Stat> setACL(String path, Iterable<org.apache.zookeeper.data.ACL> acl, int version)
ZKClientpath - The path to have ACL being set.acl - ACL to set to.version - Version of the node.OperationFuture that will be completed when the setACL call is done, with the node Stat
available as the future result. If there is error, it will be reflected as error in the future.Copyright © 2013-2016 The Apache Software Foundation. All rights reserved.