@InterfaceAudience.Private public class ReplicationTrackerZKImpl extends Object 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.
|
Modifier and Type | Field and Description |
---|---|
private Abortable |
abortable |
private List<ReplicationListener> |
listeners |
private static org.slf4j.Logger |
LOG |
private ArrayList<String> |
otherRegionServers |
private Stoppable |
stopper |
private ZKWatcher |
zookeeper |
Constructor and Description |
---|
ReplicationTrackerZKImpl(ZKWatcher zookeeper,
Abortable abortable,
Stoppable stopper) |
Modifier and Type | Method and Description |
---|---|
List<String> |
getListOfRegionServers()
Return a snapshot of the current region servers.
|
private List<String> |
getRegisteredRegionServers(boolean watch)
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(boolean watch)
Reads the list of region servers from ZK and atomically clears our local view of it and
replaces it with the updated list.
|
void |
registerListener(ReplicationListener listener)
Register a replication listener to receive replication events.
|
void |
removeListener(ReplicationListener listener) |
private static final org.slf4j.Logger LOG
private final List<ReplicationListener> listeners
private final ArrayList<String> otherRegionServers
public ReplicationTrackerZKImpl(ZKWatcher zookeeper, 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 String getZNodeName(String fullPath)
fullPath
- Path to extract the id fromprivate boolean refreshOtherRegionServersList(boolean watch)
private List<String> getRegisteredRegionServers(boolean watch)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.