Class ZooUtil
- java.lang.Object
-
- org.apache.accumulo.fate.zookeeper.ZooUtil
-
public class ZooUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ZooUtil.LockID
static class
ZooUtil.NodeExistsPolicy
static class
ZooUtil.NodeMissingPolicy
protected static class
ZooUtil.ZooKeeperConnectionInfo
-
Field Summary
Fields Modifier and Type Field Description static Retry.RetryFactory
DEFAULT_RETRY
static List<org.apache.zookeeper.data.ACL>
PRIVATE
static List<org.apache.zookeeper.data.ACL>
PUBLIC
-
Constructor Summary
Constructors Constructor Description ZooUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
exists(ZooUtil.ZooKeeperConnectionInfo info, String zPath)
static List<org.apache.zookeeper.data.ACL>
getACL(org.apache.zookeeper.ZooKeeper zk, String zPath, org.apache.zookeeper.data.Stat stat)
static byte[]
getData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, org.apache.zookeeper.data.Stat stat)
static String
getInstanceIDFromHdfs(org.apache.hadoop.fs.Path instanceDirectory, AccumuloConfiguration conf, org.apache.hadoop.conf.Configuration hadoopConf)
static byte[]
getLockData(ZooCache zc, String path)
static String
getRoot(String instanceId)
static org.apache.zookeeper.data.Stat
getStatus(ZooUtil.ZooKeeperConnectionInfo info, String zPath)
protected static org.apache.zookeeper.ZooKeeper
getZooKeeper(String keepers, int timeout, String scheme, byte[] auth)
protected static org.apache.zookeeper.ZooKeeper
getZooKeeper(ZooUtil.ZooKeeperConnectionInfo info)
static boolean
isLockHeld(ZooUtil.ZooKeeperConnectionInfo info, ZooUtil.LockID lid)
static String
putEphemeralData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data)
static String
putEphemeralSequential(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data)
static boolean
putPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, int version, ZooUtil.NodeExistsPolicy policy)
static boolean
putPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, int version, ZooUtil.NodeExistsPolicy policy, List<org.apache.zookeeper.data.ACL> acls)
static boolean
putPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, ZooUtil.NodeExistsPolicy policy)
Create a persistent node with the default ACLstatic String
putPersistentSequential(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data)
static boolean
putPrivatePersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, ZooUtil.NodeExistsPolicy policy)
static void
recursiveCopyPersistent(ZooUtil.ZooKeeperConnectionInfo info, String source, String destination, ZooUtil.NodeExistsPolicy policy)
protected static void
retryOrThrow(Retry retry, org.apache.zookeeper.KeeperException e)
-
-
-
Field Detail
-
DEFAULT_RETRY
public static final Retry.RetryFactory DEFAULT_RETRY
-
PRIVATE
public static final List<org.apache.zookeeper.data.ACL> PRIVATE
-
PUBLIC
public static final List<org.apache.zookeeper.data.ACL> PUBLIC
-
-
Method Detail
-
getZooKeeper
protected static org.apache.zookeeper.ZooKeeper getZooKeeper(ZooUtil.ZooKeeperConnectionInfo info)
-
getZooKeeper
protected static org.apache.zookeeper.ZooKeeper getZooKeeper(String keepers, int timeout, String scheme, byte[] auth)
-
retryOrThrow
protected static void retryOrThrow(Retry retry, org.apache.zookeeper.KeeperException e) throws org.apache.zookeeper.KeeperException
- Throws:
org.apache.zookeeper.KeeperException
-
putPersistentData
public static boolean putPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, ZooUtil.NodeExistsPolicy policy) throws org.apache.zookeeper.KeeperException, InterruptedException
Create a persistent node with the default ACL- Returns:
- true if the node was created or altered; false if it was skipped
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
putPersistentData
public static boolean putPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, int version, ZooUtil.NodeExistsPolicy policy) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
putPersistentData
public static boolean putPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, int version, ZooUtil.NodeExistsPolicy policy, List<org.apache.zookeeper.data.ACL> acls) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getData
public static byte[] getData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, org.apache.zookeeper.data.Stat stat) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getStatus
public static org.apache.zookeeper.data.Stat getStatus(ZooUtil.ZooKeeperConnectionInfo info, String zPath) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
exists
public static boolean exists(ZooUtil.ZooKeeperConnectionInfo info, String zPath) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
recursiveCopyPersistent
public static void recursiveCopyPersistent(ZooUtil.ZooKeeperConnectionInfo info, String source, String destination, ZooUtil.NodeExistsPolicy policy) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
putPrivatePersistentData
public static boolean putPrivatePersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, ZooUtil.NodeExistsPolicy policy) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
putPersistentSequential
public static String putPersistentSequential(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
putEphemeralData
public static String putEphemeralData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
putEphemeralSequential
public static String putEphemeralSequential(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
isLockHeld
public static boolean isLockHeld(ZooUtil.ZooKeeperConnectionInfo info, ZooUtil.LockID lid) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getACL
public static List<org.apache.zookeeper.data.ACL> getACL(org.apache.zookeeper.ZooKeeper zk, String zPath, org.apache.zookeeper.data.Stat stat) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getInstanceIDFromHdfs
public static String getInstanceIDFromHdfs(org.apache.hadoop.fs.Path instanceDirectory, AccumuloConfiguration conf, org.apache.hadoop.conf.Configuration hadoopConf)
-
-