public class ZkConnection extends Object
| 构造器和说明 |
|---|
ZkConnection(String zkServers,
int sessionTimeOut)
build a zookeeper connection
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
void |
connect(org.apache.zookeeper.Watcher watcher) |
String |
create(String path,
byte[] data,
org.apache.zookeeper.CreateMode mode) |
void |
delete(String path) |
boolean |
exists(String path,
boolean watch) |
List<String> |
getChildren(String path,
boolean watch) |
long |
getCreateTime(String path) |
String |
getServers() |
org.apache.zookeeper.ZooKeeper |
getZooKeeper() |
org.apache.zookeeper.ZooKeeper.States |
getZookeeperState() |
List<?> |
multi(Iterable<?> ops)
wrapper for 3.3.x/3.4.x
|
byte[] |
readData(String path,
org.apache.zookeeper.data.Stat stat,
boolean watch) |
org.apache.zookeeper.data.Stat |
writeData(String path,
byte[] data,
int version) |
public ZkConnection(String zkServers, int sessionTimeOut)
zkServers - zookeeper connection stringsessionTimeOut - session timeout in millisecondspublic void connect(org.apache.zookeeper.Watcher watcher)
public void close()
throws InterruptedException
public String create(String path, byte[] data, org.apache.zookeeper.CreateMode mode) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void delete(String path) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic boolean exists(String path, boolean watch) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic List<String> getChildren(String path, boolean watch) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic byte[] readData(String path, org.apache.zookeeper.data.Stat stat, boolean watch) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic List<?> multi(Iterable<?> ops)
ops - multi operationspublic org.apache.zookeeper.data.Stat writeData(String path, byte[] data, int version) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic org.apache.zookeeper.ZooKeeper.States getZookeeperState()
public long getCreateTime(String path) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic String getServers()
public org.apache.zookeeper.ZooKeeper getZooKeeper()
Copyright © 2019. All rights reserved.