org.apache.hadoop.hbase.zookeeper
Class RootRegionTracker

java.lang.Object
  extended by org.apache.hadoop.hbase.zookeeper.ZooKeeperListener
      extended by org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker
          extended by org.apache.hadoop.hbase.zookeeper.RootRegionTracker

public class RootRegionTracker
extends ZooKeeperNodeTracker

Tracks the root region server location node in zookeeper. Root region location is set by RootLocationEditor usually called out of RegionServerServices. This class has a watcher on the root location and notices changes.


Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker
abortable, node
 
Fields inherited from class org.apache.hadoop.hbase.zookeeper.ZooKeeperListener
watcher
 
Constructor Summary
RootRegionTracker(ZooKeeperWatcher watcher, Abortable abortable)
          Creates a root region location tracker.
 
Method Summary
 HServerAddress getRootRegionLocation()
          Gets the root region location, if available.
 boolean isLocationAvailable()
          Checks if the root region location is available.
 HServerAddress waitRootRegionLocation(long timeout)
          Gets the root region location, if available, and waits for up to the specified timeout if not immediately available.
 
Methods inherited from class org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker
blockUntilAvailable, blockUntilAvailable, getData, getNode, nodeCreated, nodeDataChanged, nodeDeleted, start, stop
 
Methods inherited from class org.apache.hadoop.hbase.zookeeper.ZooKeeperListener
nodeChildrenChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RootRegionTracker

public RootRegionTracker(ZooKeeperWatcher watcher,
                         Abortable abortable)
Creates a root region location tracker.

After construction, use ZooKeeperNodeTracker.start() to kick off tracking.

Parameters:
watcher -
abortable -
Method Detail

isLocationAvailable

public boolean isLocationAvailable()
Checks if the root region location is available.

Returns:
true if root region location is available, false if not

getRootRegionLocation

public HServerAddress getRootRegionLocation()
                                     throws InterruptedException
Gets the root region location, if available. Null if not. Does not block.

Returns:
server address for server hosting root region, null if none available
Throws:
InterruptedException

waitRootRegionLocation

public HServerAddress waitRootRegionLocation(long timeout)
                                      throws InterruptedException
Gets the root region location, if available, and waits for up to the specified timeout if not immediately available.

Parameters:
timeout - maximum time to wait, in millis
Returns:
server address for server hosting root region, null if timed out
Throws:
InterruptedException - if interrupted while waiting


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.