@InterfaceAudience.Private public class ReplicationTrackerZKImpl extends ReplicationStateZKBase implements ReplicationTracker
Modifier and Type | Class and Description |
---|---|
class |
ReplicationTrackerZKImpl.OtherRegionServerWatcher
Watcher used to be notified of the other region server's death in the local cluster.
|
class |
ReplicationTrackerZKImpl.PeersWatcher
Watcher used to follow the creation and deletion of peer clusters.
|
Modifier and Type | Field and Description |
---|---|
private List<ReplicationListener> |
listeners |
private static org.apache.commons.logging.Log |
LOG |
private ArrayList<String> |
otherRegionServers |
private ReplicationPeers |
replicationPeers |
private Stoppable |
stopper |
abortable, conf, DISABLED_ZNODE_BYTES, ENABLED_ZNODE_BYTES, ourClusterKey, peerStateNodeName, peersZNode, queuesZNode, replicationZNode, zookeeper
Constructor and Description |
---|
ReplicationTrackerZKImpl(ZooKeeperWatcher zookeeper,
ReplicationPeers replicationPeers,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable,
Stoppable stopper) |
Modifier and Type | Method and Description |
---|---|
List<String> |
getListOfRegionServers()
Return a snapshot of the current region servers.
|
private String |
getPeersZNode() |
private List<String> |
getRegisteredRegionServers()
Get a list of all the other region servers in this cluster and set a watch
|
private String |
getZNodeName(String fullPath)
Extracts the znode name of a peer cluster from a ZK path
|
private boolean |
refreshOtherRegionServersList()
Reads the list of region servers from ZK and atomically clears our local view of it and
replaces it with the updated list.
|
private List<String> |
refreshPeersList(String path)
Verify if this event is meant for us, and if so then get the latest peers' list from ZK.
|
void |
registerListener(ReplicationListener listener)
Register a replication listener to receive replication events.
|
void |
removeListener(ReplicationListener listener) |
getListOfReplicatorsZK, isPeerPath, peerExists, toByteArray
private static final org.apache.commons.logging.Log LOG
private final Stoppable stopper
private final List<ReplicationListener> listeners
private final ReplicationPeers replicationPeers
public ReplicationTrackerZKImpl(ZooKeeperWatcher zookeeper, ReplicationPeers replicationPeers, org.apache.hadoop.conf.Configuration conf, Abortable abortable, Stoppable stopper)
public void registerListener(ReplicationListener listener)
ReplicationTracker
registerListener
in interface ReplicationTracker
public void removeListener(ReplicationListener listener)
removeListener
in interface ReplicationTracker
public List<String> getListOfRegionServers()
getListOfRegionServers
in interface ReplicationTracker
private List<String> refreshPeersList(String path)
path
- path to check againstprivate String getPeersZNode()
private String getZNodeName(String fullPath)
fullPath
- Path to extract the id fromprivate boolean refreshOtherRegionServersList()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.