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.Private
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  HConnection connection
           
protected  HRegionLocation location
           
protected static int MIN_WAIT_DEAD_SERVER
           
protected  byte[] row
           
protected  boolean serverHasMoreResults
           
protected  boolean serverHasMoreResultsContext
           
protected  TableName tableName
           
 
Constructor Summary
RegionServerCallable(HConnection connection, TableName tableName, byte[] row)
           
 
Method Summary
 String getExceptionMessageAdditionalDetail()
           
 HRegionInfo getHRegionInfo()
           
protected  HRegionLocation getLocation()
           
 byte[] getRow()
           
protected  boolean getServerHasMoreResults()
          Should the client attempt to fetch more results from this region
protected  ClientProtos.ClientService.BlockingInterface getStub()
           
 TableName getTableName()
           
protected  boolean hasMoreResultsContext()
          Did the server respond with information about whether more results might exist.
 void prepare(boolean reload)
          Prepare for connection to the server hosting region with row from tablename.
protected  void setHasMoreResultsContext(boolean serverHasMoreResultsContext)
           
protected  void setLocation(HRegionLocation location)
           
protected  void setServerHasMoreResults(boolean serverHasMoreResults)
           
 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

connection

protected final HConnection connection

tableName

protected final TableName tableName

row

protected final byte[] row

location

protected HRegionLocation location

serverHasMoreResultsContext

protected boolean serverHasMoreResultsContext

serverHasMoreResults

protected boolean serverHasMoreResults

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

getHRegionInfo

public HRegionInfo getHRegionInfo()
Returns:
the HRegionInfo for the current region

getServerHasMoreResults

protected boolean getServerHasMoreResults()
Should the client attempt to fetch more results from this region

Returns:
True if the client should attempt to fetch more results, false otherwise.

setServerHasMoreResults

protected void setServerHasMoreResults(boolean serverHasMoreResults)

hasMoreResultsContext

protected boolean hasMoreResultsContext()
Did the server respond with information about whether more results might exist. Not guaranteed to respond with older server versions

Returns:
True if the server responded with information about more results.

setHasMoreResultsContext

protected void setHasMoreResultsContext(boolean serverHasMoreResultsContext)


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