@InterfaceAudience.Private public class RegionServerTracker extends ZooKeeperListener
Handling of new RSs checking in is done via RPC. This class is only responsible for watching for expired nodes. It handles listening for changes in the RS node list and watching each node.
If an RS node gets deleted, this automatically handles calling of
ServerManager.expireServer(ServerName)
Modifier and Type | Field and Description |
---|---|
private static org.apache.commons.logging.Log |
LOG |
private NavigableMap<ServerName,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionServerInfo> |
regionServers |
private Server |
server |
private ServerManager |
serverManager |
watcher
Constructor and Description |
---|
RegionServerTracker(ZooKeeperWatcher watcher,
Server server,
ServerManager serverManager) |
Modifier and Type | Method and Description |
---|---|
private void |
add(List<String> servers) |
List<ServerName> |
getOnlineServers()
Gets the online servers.
|
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionServerInfo |
getRegionServerInfo(ServerName sn) |
void |
nodeChildrenChanged(String path)
Called when an existing node has a child node added or removed.
|
void |
nodeDeleted(String path)
Called when a node has been deleted
|
private void |
remove(ServerName sn) |
void |
start()
Starts the tracking of online RegionServers.
|
getWatcher, nodeCreated, nodeDataChanged
private static final org.apache.commons.logging.Log LOG
private NavigableMap<ServerName,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionServerInfo> regionServers
private ServerManager serverManager
private Server server
public RegionServerTracker(ZooKeeperWatcher watcher, Server server, ServerManager serverManager)
public void start() throws org.apache.zookeeper.KeeperException, IOException
All RSs will be tracked after this method is called.
org.apache.zookeeper.KeeperException
IOException
private void add(List<String> servers) throws IOException
IOException
private void remove(ServerName sn)
public void nodeDeleted(String path)
ZooKeeperListener
nodeDeleted
in class ZooKeeperListener
path
- full path of the deleted nodepublic void nodeChildrenChanged(String path)
ZooKeeperListener
nodeChildrenChanged
in class ZooKeeperListener
path
- full path of the node whose children have changedpublic org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionServerInfo getRegionServerInfo(ServerName sn)
public List<ServerName> getOnlineServers()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.