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 classZooUtil.LockIDstatic classZooUtil.NodeExistsPolicystatic classZooUtil.NodeMissingPolicyprotected static classZooUtil.ZooKeeperConnectionInfo
-
Field Summary
Fields Modifier and Type Field Description static Retry.RetryFactoryDEFAULT_RETRYstatic List<org.apache.zookeeper.data.ACL>PRIVATEstatic 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 booleanexists(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 byte[]getLockData(ZooCache zc, String path)static org.apache.zookeeper.data.StatgetStatus(ZooUtil.ZooKeeperConnectionInfo info, String zPath)protected static org.apache.zookeeper.ZooKeepergetZooKeeper(String keepers, int timeout, String scheme, byte[] auth)protected static org.apache.zookeeper.ZooKeepergetZooKeeper(ZooUtil.ZooKeeperConnectionInfo info)static booleanisLockHeld(ZooUtil.ZooKeeperConnectionInfo info, ZooUtil.LockID lid)static StringputEphemeralData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data)static StringputEphemeralSequential(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data)static booleanputPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, int version, ZooUtil.NodeExistsPolicy policy)static booleanputPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, int version, ZooUtil.NodeExistsPolicy policy, List<org.apache.zookeeper.data.ACL> acls)static booleanputPersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, ZooUtil.NodeExistsPolicy policy)Create a persistent node with the default ACLstatic StringputPersistentSequential(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data)static booleanputPrivatePersistentData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data, ZooUtil.NodeExistsPolicy policy)static voidrecursiveCopyPersistent(ZooUtil.ZooKeeperConnectionInfo info, String source, String destination, ZooUtil.NodeExistsPolicy policy)protected static voidretryOrThrow(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.KeeperExceptionInterruptedException
-
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.KeeperExceptionInterruptedException
-
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.KeeperExceptionInterruptedException
-
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.KeeperExceptionInterruptedException
-
getStatus
public static org.apache.zookeeper.data.Stat getStatus(ZooUtil.ZooKeeperConnectionInfo info, String zPath) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
exists
public static boolean exists(ZooUtil.ZooKeeperConnectionInfo info, String zPath) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
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.KeeperExceptionInterruptedException
-
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.KeeperExceptionInterruptedException
-
putPersistentSequential
public static String putPersistentSequential(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
putEphemeralData
public static String putEphemeralData(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
putEphemeralSequential
public static String putEphemeralSequential(ZooUtil.ZooKeeperConnectionInfo info, String zPath, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
isLockHeld
public static boolean isLockHeld(ZooUtil.ZooKeeperConnectionInfo info, ZooUtil.LockID lid) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
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.KeeperExceptionInterruptedException
-
-