|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher
public class ZooKeeperWatcher
Acts as the single ZooKeeper Watcher. One instance of this is instantiated for each Master, RegionServer, and client process.
This is the only class that implements Watcher
. Other internal
classes which need to be notified of ZooKeeper events must register with
the local instance of this watcher via registerListener(org.apache.hadoop.hbase.zookeeper.ZooKeeperListener)
.
This class also holds and manages the connection to ZooKeeper. Code to deal with connection related events and exceptions are handled here.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher |
---|
org.apache.zookeeper.Watcher.Event |
Field Summary | |
---|---|
String |
assignmentZNode
|
String |
baseZNode
|
String |
clusterStateZNode
|
String |
masterAddressZNode
|
String |
rootServerZNode
|
String |
rsZNode
|
String |
tableZNode
|
Constructor Summary | |
---|---|
ZooKeeperWatcher(org.apache.hadoop.conf.Configuration conf,
String descriptor,
Abortable abortable)
Instantiate a ZooKeeper connection and watcher. |
Method Summary | |
---|---|
void |
abort(String why,
Throwable e)
Abort the server or client. |
void |
close()
Close the connection to ZooKeeper. |
Set<String> |
getNodes()
Get the set of already watched unassigned nodes. |
String |
getQuorum()
Get the quorum address of this instance. |
org.apache.zookeeper.ZooKeeper |
getZooKeeper()
Get the connection to ZooKeeper. |
void |
interruptedException(InterruptedException ie)
Handles InterruptedExceptions in client calls. |
void |
keeperException(org.apache.zookeeper.KeeperException ke)
Handles KeeperExceptions in client calls. |
String |
prefix(String str)
Adds this instance's identifier as a prefix to the passed str |
void |
process(org.apache.zookeeper.WatchedEvent event)
Method called from ZooKeeper for events and connection status. |
void |
registerListener(ZooKeeperListener listener)
Register the specified listener to receive ZooKeeper events. |
void |
registerListenerFirst(ZooKeeperListener listener)
Register the specified listener to receive ZooKeeper events and add it as the first in the list of current listeners. |
void |
sync(String path)
Forces a synchronization of this ZooKeeper client connection. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public String baseZNode
public String rootServerZNode
public String rsZNode
public String masterAddressZNode
public String clusterStateZNode
public String assignmentZNode
public String tableZNode
Constructor Detail |
---|
public ZooKeeperWatcher(org.apache.hadoop.conf.Configuration conf, String descriptor, Abortable abortable) throws IOException, ZooKeeperConnectionException
descriptor
- Descriptive string that is added to zookeeper sessionid
and used as identifier for this instance.
IOException
ZooKeeperConnectionException
Method Detail |
---|
public String toString()
toString
in class Object
public String prefix(String str)
str
str
- String to amend.
public void registerListener(ZooKeeperListener listener)
listener
- public void registerListenerFirst(ZooKeeperListener listener)
listener
- public org.apache.zookeeper.ZooKeeper getZooKeeper()
public String getQuorum()
public void process(org.apache.zookeeper.WatchedEvent event)
process
in interface org.apache.zookeeper.Watcher
public void sync(String path)
Executing this method before running other methods will ensure that the subsequent operations are up-to-date and consistent as of the time that the sync is complete.
This is used for compareAndSwap type operations where we need to read the data of an existing node and delete or transition that node, utilizing the previously read version and data. We want to ensure that the version read is up-to-date from when we begin the operation.
public Set<String> getNodes()
public void keeperException(org.apache.zookeeper.KeeperException ke) throws org.apache.zookeeper.KeeperException
ke
-
org.apache.zookeeper.KeeperException
public void interruptedException(InterruptedException ie)
ie
- public void close()
InterruptedException
public void abort(String why, Throwable e)
Abortable
abort
in interface Abortable
why
- Why we're aborting.e
- Throwable that caused abort. Can be null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |