|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.replication.ReplicationPeer
@InterfaceAudience.Private public class ReplicationPeer
This class acts as a wrapper for all the objects used to identify and communicate with remote peers and is responsible for answering to expired sessions and re-establishing the ZK connections.
| Nested Class Summary | |
|---|---|
class |
ReplicationPeer.PeerStateTracker
Tracker for state of this peer |
| Constructor Summary | |
|---|---|
ReplicationPeer(org.apache.hadoop.conf.Configuration conf,
String key,
String id)
Constructor that takes all the objects required to communicate with the specified peer, except for the region server addresses. |
|
| Method Summary | |
|---|---|
void |
abort(String why,
Throwable e)
Abort the server or client. |
void |
close()
|
String |
getClusterKey()
Get the cluster key of that peer |
org.apache.hadoop.conf.Configuration |
getConfiguration()
Get the configuration object required to communicate with this peer |
String |
getId()
Get the identifier of this peer |
long |
getLastRegionserverUpdate()
Get the timestamp at which the last change occurred to the list of region servers to replicate to. |
AtomicBoolean |
getPeerEnabled()
Get the state of this peer |
List<ServerName> |
getRegionServers()
Get a list of all the addresses of all the region servers for this peer cluster |
ZooKeeperWatcher |
getZkw()
Get the ZK connection to this peer |
boolean |
isAborted()
Check if the server or client was aborted. |
static boolean |
isStateEnabled(byte[] bytes)
Parse the raw data from ZK to get a peer's state |
void |
reloadZkWatcher()
Closes the current ZKW (if not null) and creates a new one |
void |
setRegionServers(List<ServerName> regionServers)
Set the list of region servers for that peer |
void |
startStateTracker(ZooKeeperWatcher zookeeper,
String peerStateNode)
start a state tracker to check whether this peer is enabled or not |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReplicationPeer(org.apache.hadoop.conf.Configuration conf,
String key,
String id)
throws IOException
conf - configuration object to this peerkey - cluster key used to locate the peerid - string representation of this peer's identifier
IOException| Method Detail |
|---|
public void startStateTracker(ZooKeeperWatcher zookeeper,
String peerStateNode)
throws org.apache.zookeeper.KeeperException
zookeeper - zk watcher for the local clusterpeerStateNode - path to zk node which stores peer state
org.apache.zookeeper.KeeperExceptionpublic String getClusterKey()
public AtomicBoolean getPeerEnabled()
public List<ServerName> getRegionServers()
public void setRegionServers(List<ServerName> regionServers)
regionServers - list of addresses for the region serverspublic ZooKeeperWatcher getZkw()
public long getLastRegionserverUpdate()
public String getId()
public org.apache.hadoop.conf.Configuration getConfiguration()
public void abort(String why,
Throwable e)
Abortable
abort in interface Abortablewhy - Why we're aborting.e - Throwable that caused abort. Can be null.
public void reloadZkWatcher()
throws IOException
IOException - If anything goes wrong connectingpublic boolean isAborted()
Abortable
isAborted in interface Abortable
public void close()
throws IOException
close in interface CloseableIOException
public static boolean isStateEnabled(byte[] bytes)
throws DeserializationException
bytes - raw ZK data
bytes are those of a pb serialized ENABLED state.
DeserializationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||