public class ZooKeeperConnection extends Object
| Constructor and Description |
|---|
ZooKeeperConnection(String quorumAddresses) |
| Modifier and Type | Method and Description |
|---|---|
void |
deregisterObserver(ZooKeeperConnectionObserver observer) |
org.apache.zookeeper.ZooKeeper |
get()
Get the connection to the ZooKeeper quorum maintained by this class.
|
org.apache.zookeeper.ZooKeeper |
getActiveConnection()
Get a connection to the ZooKeeper quorum that is guaranteed to be in a connected state.
|
void |
registerObserver(ZooKeeperConnectionObserver observer) |
void |
reset()
Remove any preexisting ZooKeeper connection instance.
|
void |
shutdown() |
public ZooKeeperConnection(String quorumAddresses) throws IOException
IOExceptionpublic org.apache.zookeeper.ZooKeeper getActiveConnection()
throws IOException
IOException is thrown.IOExceptionpublic org.apache.zookeeper.ZooKeeper get()
throws IOException
getActiveConnection() if you require this guarantee).IOExceptionpublic void shutdown()
public void registerObserver(ZooKeeperConnectionObserver observer)
public void deregisterObserver(ZooKeeperConnectionObserver observer)
public void reset()
This method should be called when the connection to the ZooKeeper is expired, so a subsequent call to
get() will establish a new connection.
Copyright © 2014–2017 Lable. All rights reserved.