org.apache.hadoop.hbase.master
Class ZKMasterAddressWatcher
java.lang.Object
org.apache.hadoop.hbase.master.ZKMasterAddressWatcher
- All Implemented Interfaces:
- org.apache.zookeeper.Watcher
public class ZKMasterAddressWatcher
- extends Object
- implements org.apache.zookeeper.Watcher
ZooKeeper watcher for the master address. Used by the HMaster to wait for
the event when master address ZNode gets deleted. When multiple masters are
brought up, they race to become master by writing to write their address to
ZooKeeper. Whoever wins becomes the master, and the rest wait for that
ephemeral node in ZooKeeper to get deleted (meaning the master went down), at
which point they try to write to it again.
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher |
org.apache.zookeeper.Watcher.Event |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZKMasterAddressWatcher
public ZKMasterAddressWatcher(HMaster master)
- Create a watcher with a ZooKeeperWrapper instance.
- Parameters:
master
- The master.
process
public void process(org.apache.zookeeper.WatchedEvent event)
- Specified by:
process
in interface org.apache.zookeeper.Watcher
- See Also:
Watcher.process(org.apache.zookeeper.WatchedEvent)
waitForMasterAddressAvailability
public void waitForMasterAddressAvailability()
- Wait for master address to be available. This sets a watch in ZooKeeper and
blocks until the master address ZNode gets deleted.
Copyright © 2010 The Apache Software Foundation