org.apache.hadoop.hbase.replication
Class HBaseReplicationEndpoint

java.lang.Object
  extended by com.google.common.util.concurrent.AbstractService
      extended by org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
          extended by org.apache.hadoop.hbase.replication.HBaseReplicationEndpoint
All Implemented Interfaces:
com.google.common.util.concurrent.Service, Abortable, ReplicationEndpoint, ReplicationPeerConfigListener
Direct Known Subclasses:
HBaseInterClusterReplicationEndpoint

@InterfaceAudience.Private
public abstract class HBaseReplicationEndpoint
extends BaseReplicationEndpoint
implements Abortable

A BaseReplicationEndpoint for replication endpoints whose target cluster is an HBase cluster.


Nested Class Summary
static class HBaseReplicationEndpoint.PeerRegionServerListener
          Tracks changes to the list of region servers in a peer's cluster.
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.replication.ReplicationEndpoint
ReplicationEndpoint.Context, ReplicationEndpoint.ReplicateContext
 
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.State
 
Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
ctx
 
Constructor Summary
HBaseReplicationEndpoint()
           
 
Method Summary
 void abort(String why, Throwable e)
          Abort the server or client.
protected  void disconnect()
           
protected  void doStart()
           
protected  void doStop()
           
protected static List<ServerName> fetchSlavesAddresses(ZooKeeperWatcher zkw)
          Get the list of all the region servers from the specified peer
 long getLastRegionServerUpdate()
          Get the timestamp at which the last change occurred to the list of region servers to replicate to.
 UUID getPeerUUID()
          Returns a UUID of the provided peer id.
 List<ServerName> getRegionServers()
          Get a list of all the addresses of all the region servers for this peer cluster
protected  ZooKeeperWatcher getZkw()
          Get the ZK connection to this peer
 boolean isAborted()
          Check if the server or client was aborted.
protected  void reconnect(org.apache.zookeeper.KeeperException ke)
          A private method used to re-establish a zookeeper session with a peer cluster.
 void setRegionServers(List<ServerName> regionServers)
          Set the list of region servers for that peer
 
Methods inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
canReplicateToSameCluster, getScopeWALEntryFilter, getTableCfWALEntryFilter, getWALEntryfilter, init, peerConfigUpdated
 
Methods inherited from class com.google.common.util.concurrent.AbstractService
isRunning, notifyFailed, notifyStarted, notifyStopped, start, startAndWait, state, stop, stopAndWait, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.replication.ReplicationEndpoint
replicate
 
Methods inherited from interface com.google.common.util.concurrent.Service
isRunning, start, startAndWait, state, stop, stopAndWait
 

Constructor Detail

HBaseReplicationEndpoint

public HBaseReplicationEndpoint()
Method Detail

disconnect

protected void disconnect()

reconnect

protected void reconnect(org.apache.zookeeper.KeeperException ke)
A private method used to re-establish a zookeeper session with a peer cluster.

Parameters:
ke -

doStart

protected void doStart()
Specified by:
doStart in class com.google.common.util.concurrent.AbstractService

doStop

protected void doStop()
Specified by:
doStop in class com.google.common.util.concurrent.AbstractService

getPeerUUID

public UUID getPeerUUID()
Description copied from interface: ReplicationEndpoint
Returns a UUID of the provided peer id. Every HBase cluster instance has a persisted associated UUID. If the replication is not performed to an actual HBase cluster (but some other system), the UUID returned has to uniquely identify the connected target system.

Specified by:
getPeerUUID in interface ReplicationEndpoint
Returns:
a UUID or null if the peer cluster does not exist or is not connected.

getZkw

protected ZooKeeperWatcher getZkw()
Get the ZK connection to this peer

Returns:
zk connection

abort

public void abort(String why,
                  Throwable e)
Description copied from interface: Abortable
Abort the server or client.

Specified by:
abort in interface Abortable
Parameters:
why - Why we're aborting.
e - Throwable that caused abort. Can be null.

isAborted

public boolean isAborted()
Description copied from interface: Abortable
Check if the server or client was aborted.

Specified by:
isAborted in interface Abortable
Returns:
true if the server or client was aborted, false otherwise

fetchSlavesAddresses

protected static List<ServerName> fetchSlavesAddresses(ZooKeeperWatcher zkw)
                                                throws org.apache.zookeeper.KeeperException
Get the list of all the region servers from the specified peer

Parameters:
zkw - zk connection to use
Returns:
list of region server addresses or an empty list if the slave is unavailable
Throws:
org.apache.zookeeper.KeeperException

getRegionServers

public List<ServerName> getRegionServers()
Get a list of all the addresses of all the region servers for this peer cluster

Returns:
list of addresses
Throws:
org.apache.zookeeper.KeeperException

setRegionServers

public void setRegionServers(List<ServerName> regionServers)
Set the list of region servers for that peer

Parameters:
regionServers - list of addresses for the region servers

getLastRegionServerUpdate

public long getLastRegionServerUpdate()
Get the timestamp at which the last change occurred to the list of region servers to replicate to.

Returns:
The System.currentTimeMillis at the last time the list of peer region servers changed.


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.