T
- the class that the ServerCallable handles@InterfaceAudience.Private public abstract class RegionServerCallable<T> extends Object implements RetryingCallable<T>
RetryingCallable.call(int)
.
Passed to a RpcRetryingCaller
so we retry on fail.
TODO: this class is actually tied to one region, because most of the paths make use of
the regioninfo part of location when building requests. The only reason it works for
multi-region requests (e.g. batch) is that they happen to not use the region parts.
This could be done cleaner (e.g. having a generic parameter and 2 derived classes,
RegionCallable and actual RegionServerCallable with ServerName.Modifier and Type | Field and Description |
---|---|
protected Connection |
connection |
protected HRegionLocation |
location |
protected static int |
MIN_WAIT_DEAD_SERVER |
protected byte[] |
row |
protected TableName |
tableName |
Constructor and Description |
---|
RegionServerCallable(Connection connection,
TableName tableName,
byte[] row) |
Modifier and Type | Method and Description |
---|---|
String |
getExceptionMessageAdditionalDetail() |
HRegionInfo |
getHRegionInfo() |
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
RetryingCallable.call(int) 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.). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
call
protected final Connection connection
protected final TableName tableName
protected final byte[] row
protected HRegionLocation location
protected static final int MIN_WAIT_DEAD_SERVER
public RegionServerCallable(Connection connection, TableName tableName, byte[] row)
connection
- Connection to use.tableName
- Table name to which row
belongs.row
- The row we want in tableName
.public void prepare(boolean reload) throws IOException
prepare
in interface RetryingCallable<T>
reload
- Set this to true if connection should re-find the regionIOException
- eprotected ClientProtos.ClientService.BlockingInterface getStub()
protected HRegionLocation getLocation()
protected void setLocation(HRegionLocation location)
public TableName getTableName()
public byte[] getRow()
public void throwable(Throwable t, boolean retrying)
RetryingCallable
RetryingCallable.call(int)
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.).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)public String getExceptionMessageAdditionalDetail()
getExceptionMessageAdditionalDetail
in interface RetryingCallable<T>
public long sleep(long pause, int tries)
sleep
in interface RetryingCallable<T>
public HRegionInfo getHRegionInfo()
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.