public class ZookeeperMgr extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
LOGGER |
| Modifier and Type | Method and Description |
|---|---|
String |
createEphemeralNode(String path,
String value,
org.apache.zookeeper.CreateMode createMode) |
void |
deleteNode(String path) |
boolean |
exists(String path) |
static ZookeeperMgr |
getInstance() |
List<String> |
getRootChildren() |
org.apache.zookeeper.ZooKeeper |
getZk() |
void |
init(String host,
String defaultPrefixString,
boolean debug) |
void |
makeDir(String dir,
String data)
Zoo的新建目录
|
String |
read(String path,
org.apache.zookeeper.Watcher watcher,
org.apache.zookeeper.data.Stat stat) |
String |
readUrl(String url,
org.apache.zookeeper.Watcher watcher) |
void |
reconnect()
重新连接
|
void |
release() |
void |
writePersistentUrl(String url,
String value) |
public void init(String host, String defaultPrefixString, boolean debug) throws Exception
Exceptionpublic static ZookeeperMgr getInstance()
public void reconnect()
public void release()
throws InterruptedException
InterruptedExceptionpublic void writePersistentUrl(String url, String value) throws Exception
Exceptionpublic String readUrl(String url, org.apache.zookeeper.Watcher watcher) throws Exception
Exceptionpublic org.apache.zookeeper.ZooKeeper getZk()
public String createEphemeralNode(String path, String value, org.apache.zookeeper.CreateMode createMode) throws Exception
Exceptionpublic String read(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.data.Stat stat) throws InterruptedException, org.apache.zookeeper.KeeperException
path - watcher - stat - InterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic void deleteNode(String path)
path - Copyright © 2015–2016 Baidu. All rights reserved.