org.apache.hadoop.hbase.client
Class RegionServerCallable<T>

java.lang.Object
  extended by org.apache.hadoop.hbase.client.RegionServerCallable<T>
Type Parameters:
T - the class that the ServerCallable handles
All Implemented Interfaces:
Callable<T>, RetryingCallable<T>
Direct Known Subclasses:
ScannerCallable

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class RegionServerCallable<T>
extends Object
implements RetryingCallable<T>

Implementations call a RegionServer and implement Callable.call(). Passed to a RpcRetryingCaller so we retry on fail.


Field Summary
protected static int MIN_WAIT_DEAD_SERVER
           
 
Constructor Summary
RegionServerCallable(HConnection connection, TableName tableName, byte[] row)
           
 
Method Summary
 String getExceptionMessageAdditionalDetail()
           
protected  HRegionLocation getLocation()
           
 byte[] getRow()
           
protected  ClientProtos.ClientService.BlockingInterface getStub()
           
 TableName getTableName()
           
 void prepare(boolean reload)
          Prepare for connection to the server hosting region with row from tablename.
protected  void setLocation(HRegionLocation location)
           
 long sleep(long pause, int tries)
           
 void throwable(Throwable t, boolean retrying)
          Called when Callable.call() throws an exception and we are going to retry; take action to make it so we succeed on next call (clear caches, do relookup of locations, etc.).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.Callable
call
 

Field Detail

MIN_WAIT_DEAD_SERVER

protected static final int MIN_WAIT_DEAD_SERVER
See Also:
Constant Field Values
Constructor Detail

RegionServerCallable

public RegionServerCallable(HConnection connection,
                            TableName tableName,
                            byte[] row)
Parameters:
connection - Connection to use.
tableName - Table name to which row belongs.
row - The row we want in tableName.
Method Detail

prepare

public void prepare(boolean reload)
             throws IOException
Prepare for connection to the server hosting region with row from tablename. Does lookup to find region location and hosting server.

Specified by:
prepare in interface RetryingCallable<T>
Parameters:
reload - Set this to true if connection should re-find the region
Throws:
IOException - e

getStub

protected ClientProtos.ClientService.BlockingInterface getStub()

getLocation

protected HRegionLocation getLocation()

setLocation

protected void setLocation(HRegionLocation location)

getTableName

public TableName getTableName()

getRow

public byte[] getRow()

throwable

public void throwable(Throwable t,
                      boolean retrying)
Description copied from interface: RetryingCallable
Called when Callable.call() throws an exception and we are going to retry; take action to make it so we succeed on next call (clear caches, do relookup of locations, etc.).

Specified by:
throwable in interface RetryingCallable<T>
retrying - True if we are in retrying mode (we are not in retrying mode when max retries == 1; we ARE in retrying mode if retries > 1 even when we are the last attempt)

getExceptionMessageAdditionalDetail

public String getExceptionMessageAdditionalDetail()
Specified by:
getExceptionMessageAdditionalDetail in interface RetryingCallable<T>
Returns:
Some details from the implementation that we would like to add to a terminating exception; i.e. a fatal exception is being thrown ending retries and we might like to add more implementation-specific detail on to the exception being thrown.

sleep

public long sleep(long pause,
                  int tries)
Specified by:
sleep in interface RetryingCallable<T>
Returns:
Suggestion on how much to sleep between retries


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.