@Private
public final class ZKCuratorManager
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
ZKCuratorManager.HadoopZookeeperFactory |
|
class |
ZKCuratorManager.SafeTransaction |
Use curator transactions to ensure zk-operations are performed in an all
or nothing fashion.
|
| Constructor | Description |
|---|---|
ZKCuratorManager(Configuration config) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Close the connection with ZooKeeper.
|
boolean |
create(java.lang.String path) |
Create a ZNode.
|
boolean |
create(java.lang.String path,
java.util.List<org.apache.zookeeper.data.ACL> zkAcl) |
Create a ZNode.
|
void |
createRootDirRecursively(java.lang.String path) |
Utility function to ensure that the configured base znode exists.
|
void |
createRootDirRecursively(java.lang.String path,
java.util.List<org.apache.zookeeper.data.ACL> zkAcl) |
Utility function to ensure that the configured base znode exists.
|
ZKCuratorManager.SafeTransaction |
createTransaction(java.util.List<org.apache.zookeeper.data.ACL> fencingACL,
java.lang.String fencingNodePath) |
|
boolean |
delete(java.lang.String path) |
Delete a ZNode.
|
boolean |
exists(java.lang.String path) |
Check if a ZNode exists.
|
java.util.List<org.apache.zookeeper.data.ACL> |
getACL(java.lang.String path) |
Get ACLs for a ZNode.
|
java.util.List<java.lang.String> |
getChildren(java.lang.String path) |
Get children of a ZNode.
|
org.apache.curator.framework.CuratorFramework |
getCurator() |
Get the curator framework managing the ZooKeeper connection.
|
byte[] |
getData(java.lang.String path) |
Get the data in a ZNode.
|
byte[] |
getData(java.lang.String path,
org.apache.zookeeper.data.Stat stat) |
Get the data in a ZNode.
|
static java.lang.String |
getNodePath(java.lang.String root,
java.lang.String nodeName) |
Get the path for a ZNode.
|
java.lang.String |
getStringData(java.lang.String path) |
Get the data in a ZNode.
|
java.lang.String |
getStringData(java.lang.String path,
org.apache.zookeeper.data.Stat stat) |
Get the data in a ZNode.
|
static java.util.List<org.apache.zookeeper.data.ACL> |
getZKAcls(Configuration conf) |
Utility method to fetch the ZK ACLs from the configuration.
|
static java.util.List<ZKUtil.ZKAuthInfo> |
getZKAuths(Configuration conf) |
Utility method to fetch ZK auth info from the configuration.
|
void |
safeCreate(java.lang.String path,
byte[] data,
java.util.List<org.apache.zookeeper.data.ACL> acl,
org.apache.zookeeper.CreateMode mode,
java.util.List<org.apache.zookeeper.data.ACL> fencingACL,
java.lang.String fencingNodePath) |
|
void |
safeDelete(java.lang.String path,
java.util.List<org.apache.zookeeper.data.ACL> fencingACL,
java.lang.String fencingNodePath) |
Deletes the path.
|
void |
safeSetData(java.lang.String path,
byte[] data,
int version,
java.util.List<org.apache.zookeeper.data.ACL> fencingACL,
java.lang.String fencingNodePath) |
|
void |
setData(java.lang.String path,
byte[] data,
int version) |
Set data into a ZNode.
|
void |
setData(java.lang.String path,
java.lang.String data,
int version) |
Set data into a ZNode.
|
void |
start() |
Start the connection to the ZooKeeper ensemble.
|
void |
start(java.util.List<org.apache.curator.framework.AuthInfo> authInfos) |
Start the connection to the ZooKeeper ensemble.
|
void |
start(java.util.List<org.apache.curator.framework.AuthInfo> authInfos,
boolean sslEnabled) |
Start the connection to the ZooKeeper ensemble.
|
public ZKCuratorManager(Configuration config) throws java.io.IOException
java.io.IOExceptionpublic org.apache.curator.framework.CuratorFramework getCurator()
public void close()
public static java.util.List<org.apache.zookeeper.data.ACL> getZKAcls(Configuration conf) throws java.io.IOException
conf - configuration.java.io.IOException - if the Zookeeper ACLs configuration file
cannot be readpublic static java.util.List<ZKUtil.ZKAuthInfo> getZKAuths(Configuration conf) throws java.io.IOException
conf - configuration.java.io.IOException - if the Zookeeper ACLs configuration file
cannot be readZKUtil.BadAuthFormatException - if the auth format is invalidpublic void start()
throws java.io.IOException
java.io.IOException - If the connection cannot be started.public void start(java.util.List<org.apache.curator.framework.AuthInfo> authInfos)
throws java.io.IOException
authInfos - List of authentication keys.java.io.IOException - If the connection cannot be started.public void start(java.util.List<org.apache.curator.framework.AuthInfo> authInfos,
boolean sslEnabled)
throws java.io.IOException
authInfos - List of authentication keys.sslEnabled - If the connection should be SSL/TLS encrypted.java.io.IOException - If the connection cannot be started.public java.util.List<org.apache.zookeeper.data.ACL> getACL(java.lang.String path)
throws java.lang.Exception
path - Path of the ZNode.java.lang.Exception - If it cannot contact Zookeeper.public byte[] getData(java.lang.String path)
throws java.lang.Exception
path - Path of the ZNode.java.lang.Exception - If it cannot contact Zookeeper.public byte[] getData(java.lang.String path,
org.apache.zookeeper.data.Stat stat)
throws java.lang.Exception
path - Path of the ZNode.stat - stat.java.lang.Exception - If it cannot contact Zookeeper.public java.lang.String getStringData(java.lang.String path)
throws java.lang.Exception
path - Path of the ZNode.java.lang.Exception - If it cannot contact Zookeeper.public java.lang.String getStringData(java.lang.String path,
org.apache.zookeeper.data.Stat stat)
throws java.lang.Exception
path - Path of the ZNode.stat - Output statistics of the ZNode.java.lang.Exception - If it cannot contact Zookeeper.public void setData(java.lang.String path,
byte[] data,
int version)
throws java.lang.Exception
path - Path of the ZNode.data - Data to set.version - Version of the data to store.java.lang.Exception - If it cannot contact Zookeeper.public void setData(java.lang.String path,
java.lang.String data,
int version)
throws java.lang.Exception
path - Path of the ZNode.data - Data to set as String.version - Version of the data to store.java.lang.Exception - If it cannot contact Zookeeper.public java.util.List<java.lang.String> getChildren(java.lang.String path)
throws java.lang.Exception
path - Path of the ZNode.java.lang.Exception - If it cannot contact Zookeeper.public boolean exists(java.lang.String path)
throws java.lang.Exception
path - Path of the ZNode.java.lang.Exception - If it cannot contact Zookeeper.public boolean create(java.lang.String path)
throws java.lang.Exception
path - Path of the ZNode.java.lang.Exception - If it cannot contact Zookeeper.public boolean create(java.lang.String path,
java.util.List<org.apache.zookeeper.data.ACL> zkAcl)
throws java.lang.Exception
path - Path of the ZNode.zkAcl - ACL for the node.java.lang.Exception - If it cannot contact Zookeeper.public void createRootDirRecursively(java.lang.String path)
throws java.lang.Exception
path - Path of the znode to create.java.lang.Exception - If it cannot create the file.public void createRootDirRecursively(java.lang.String path,
java.util.List<org.apache.zookeeper.data.ACL> zkAcl)
throws java.lang.Exception
path - Path of the znode to create.zkAcl - ACLs for ZooKeeper.java.lang.Exception - If it cannot create the file.public boolean delete(java.lang.String path)
throws java.lang.Exception
path - Path of the ZNode.java.lang.Exception - If it cannot contact ZooKeeper.public static java.lang.String getNodePath(java.lang.String root,
java.lang.String nodeName)
root - Root of the ZNode.nodeName - Name of the ZNode.public void safeCreate(java.lang.String path,
byte[] data,
java.util.List<org.apache.zookeeper.data.ACL> acl,
org.apache.zookeeper.CreateMode mode,
java.util.List<org.apache.zookeeper.data.ACL> fencingACL,
java.lang.String fencingNodePath)
throws java.lang.Exception
java.lang.Exceptionpublic void safeDelete(java.lang.String path,
java.util.List<org.apache.zookeeper.data.ACL> fencingACL,
java.lang.String fencingNodePath)
throws java.lang.Exception
path - Path to be deleted.fencingNodePath - fencingNodePath.fencingACL - fencingACL.java.lang.Exception - if any problem occurs while performing deletion.public void safeSetData(java.lang.String path,
byte[] data,
int version,
java.util.List<org.apache.zookeeper.data.ACL> fencingACL,
java.lang.String fencingNodePath)
throws java.lang.Exception
java.lang.Exceptionpublic ZKCuratorManager.SafeTransaction createTransaction(java.util.List<org.apache.zookeeper.data.ACL> fencingACL, java.lang.String fencingNodePath) throws java.lang.Exception
java.lang.ExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.