zookeeper工具

主要用于和zookeeper的连接

工具类路径:com.wueasy.base.util.CuratorHelper


/**
* 获取zk实例
* @author: fallsea
* @return CuratorFramework
*/
public static CuratorFramework getInstance();
/**
* 查询子节点列表
* @author: fallsea
* @param path 节点路径
* @return List<String>
* @throws Exception 
*/
public static List<String> getChildren(final String path) throws Exception;

/**
* @Description:判断节点是否存在 
* @author: fallsea
* @param path
* @return true 存在
* @throws Exception 
*/
public static boolean exists(final String path) throws Exception;

/**
* 创建临时节点
* @author: fallsea
* @param path
* @throws Exception 
*/
public static void createEphemeral(final String path) throws Exception;

/**
* 创建临时节点
* @author: fallsea
* @param path
* @param data
* @throws Exception 
*/
public static void createEphemeral(final String path,byte[] data) throws Exception;

/**
* 创建临时有序节点
* @author: fallsea
* @param path
* @throws Exception
*/
public static void createEphemeralSequential(final String path) throws Exception;

/**
* 创建临时有序节点
* @author: fallsea
* @param path
* @param data
* @throws Exception
*/
public static void createEphemeralSequential(final String path,byte[] data) throws Exception;

/**
* 创建永久节点
* @author: fallsea
* @param path
* @throws Exception 
*/
public static void createPersistent(final String path) throws Exception;

/**
* 创建永久节点
* @author: fallsea
* @param path
* @param data
* @throws Exception 
*/
public static void createPersistent(final String path,byte[] data) throws Exception;

/**
* 删除节点
* @author: fallsea
* @param path
* @throws Exception 
*/
public static void delete(final String path) throws Exception ;

/**
* 获取节点数据
* @author: fallsea
* @param path
* @return
* @throws Exception
*/
public static byte[] getData(String path) throws Exception;

/**
* 设置某个Zookeeper节点的数据
* @author: fallsea
* @param path
* @param nodeValue
* @throws Exception
*/
public static void setData(String path, byte[] nodeValue) throws Exception;
Copyright © wueasy.com 2017-2022 all right reserved,powered by Gitbook未经允许,禁止以任何形式传播 修订时间: 2022-09-04

results matching ""

    No results matching ""