com.taobao.metamorphosis.utils
类 ZkUtils

java.lang.Object
  继承者 com.taobao.metamorphosis.utils.ZkUtils

public class ZkUtils
extends Object

与zk交互的工具类

作者:
boyan, wuhua

嵌套类摘要
static class ZkUtils.StringSerializer
           
static class ZkUtils.ZKConfig
           
 
构造方法摘要
ZkUtils()
           
 
方法摘要
static void createEphemeralPath(org.I0Itec.zkclient.ZkClient client, String path, String data)
          Create an ephemeral node with the given path and data.
static void createEphemeralPathExpectConflict(org.I0Itec.zkclient.ZkClient client, String path, String data)
          Create an ephemeral node with the given path and data.
static void createParentPath(org.I0Itec.zkclient.ZkClient client, String path)
          create the parent path
static void deletePath(org.I0Itec.zkclient.ZkClient client, String path)
           
static void deletePathRecursive(org.I0Itec.zkclient.ZkClient client, String path)
           
static List<String> getChildren(org.I0Itec.zkclient.ZkClient client, String path)
           
static List<String> getChildrenMaybeNull(org.I0Itec.zkclient.ZkClient client, String path)
           
static String getLastPart(String path)
           
static void makeSurePersistentPathExists(org.I0Itec.zkclient.ZkClient client, String path)
          make sure a persiste.nt path exists in ZK.
static boolean pathExists(org.I0Itec.zkclient.ZkClient client, String path)
          Check if the given path exists
static String readData(org.I0Itec.zkclient.ZkClient client, String path)
           
static String readDataMaybeNull(org.I0Itec.zkclient.ZkClient client, String path)
           
static void updateEphemeralPath(org.I0Itec.zkclient.ZkClient client, String path, String data)
          Update the value of a persistent node with the given path and data.
static void updatePersistentPath(org.I0Itec.zkclient.ZkClient client, String path, String data)
          Update the value of a persistent node with the given path and data.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ZkUtils

public ZkUtils()
方法详细信息

makeSurePersistentPathExists

public static void makeSurePersistentPathExists(org.I0Itec.zkclient.ZkClient client,
                                                String path)
                                         throws Exception
make sure a persiste.nt path exists in ZK. Create the path if not exist.

抛出:
Exception

createParentPath

public static void createParentPath(org.I0Itec.zkclient.ZkClient client,
                                    String path)
                             throws Exception
create the parent path

抛出:
Exception

createEphemeralPath

public static void createEphemeralPath(org.I0Itec.zkclient.ZkClient client,
                                       String path,
                                       String data)
                                throws Exception
Create an ephemeral node with the given path and data. Create parents if necessary.

抛出:
Exception

createEphemeralPathExpectConflict

public static void createEphemeralPathExpectConflict(org.I0Itec.zkclient.ZkClient client,
                                                     String path,
                                                     String data)
                                              throws Exception
Create an ephemeral node with the given path and data. Throw NodeExistException if node already exists.

抛出:
Exception

updatePersistentPath

public static void updatePersistentPath(org.I0Itec.zkclient.ZkClient client,
                                        String path,
                                        String data)
                                 throws Exception
Update the value of a persistent node with the given path and data. create parrent directory if necessary. Never throw NodeExistException.

抛出:
Exception

readData

public static String readData(org.I0Itec.zkclient.ZkClient client,
                              String path)

readDataMaybeNull

public static String readDataMaybeNull(org.I0Itec.zkclient.ZkClient client,
                                       String path)

updateEphemeralPath

public static void updateEphemeralPath(org.I0Itec.zkclient.ZkClient client,
                                       String path,
                                       String data)
                                throws Exception
Update the value of a persistent node with the given path and data. create parrent directory if necessary. Never throw NodeExistException.

抛出:
Exception

deletePath

public static void deletePath(org.I0Itec.zkclient.ZkClient client,
                              String path)
                       throws Exception
抛出:
Exception

deletePathRecursive

public static void deletePathRecursive(org.I0Itec.zkclient.ZkClient client,
                                       String path)
                                throws Exception
抛出:
Exception

getChildren

public static List<String> getChildren(org.I0Itec.zkclient.ZkClient client,
                                       String path)

getChildrenMaybeNull

public static List<String> getChildrenMaybeNull(org.I0Itec.zkclient.ZkClient client,
                                                String path)

pathExists

public static boolean pathExists(org.I0Itec.zkclient.ZkClient client,
                                 String path)
Check if the given path exists


getLastPart

public static String getLastPart(String path)


Copyright © 2010–2013. All rights reserved.