public class ZKMetaLoader extends Object implements MetaLoader
| 构造器和说明 |
|---|
ZKMetaLoader() |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
get(String path)
获取zookeeper节点的数据
在zk没完成连接或者是丢失连接等情况下抛出异常;在节点有问题(如不存在)的情况下抛出异常
本方法无状态,可以多线程访问
|
String |
getConnectString() |
String |
getMeta(String path)
/** 从指定的路径中加载meta data
|
void |
setConnectString(String connectString) |
org.apache.zookeeper.data.Stat |
stat(String path)
获取zookeeper节点的信息,可以用来判断节点是否存在
在zk没完成连接或者是丢失连接等情况下抛出异常;
节点不存在将返回null
|
public String getConnectString()
public void setConnectString(String connectString)
public String getMeta(String path) throws org.apache.zookeeper.KeeperException
MetaLoadergetMeta 在接口中 MetaLoaderpath - zk pathorg.apache.zookeeper.KeeperException - KeeperExceptionpublic org.apache.zookeeper.data.Stat stat(String path) throws org.apache.zookeeper.KeeperException, InterruptedException
MetaLoader在zk没完成连接或者是丢失连接等情况下抛出异常;
节点不存在将返回null
stat 在接口中 MetaLoaderpath - zookeeper路径org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic byte[] get(String path) throws org.apache.zookeeper.KeeperException
MetaLoader本方法无状态,可以多线程访问
get 在接口中 MetaLoaderpath - zookeeper路径org.apache.zookeeper.KeeperExceptionCopyright © 2017. All rights reserved.