T
- the class that the ServerCallable handlespublic abstract class ServerCallable<T> extends Object implements Callable<T>
Callable
. Implementation stipulates
return type and method we actually invoke on remote Server. Usually
used inside a try/catch that fields usual connection failures all wrapped
up in a retry loop.
Call connect(boolean)
to connect to server hosting region
that contains the passed row in the passed table before invoking
Callable.call()
.
Modifier and Type | Field and Description |
---|---|
protected int |
callTimeout |
protected HConnection |
connection |
protected long |
endTime |
protected long |
globalStartTime |
protected HRegionLocation |
location |
protected static int |
MIN_RPC_TIMEOUT |
protected byte[] |
row |
protected HRegionInterface |
server |
protected long |
startTime |
protected byte[] |
tableName |
Constructor and Description |
---|
ServerCallable(HConnection connection,
byte[] tableName,
byte[] row) |
ServerCallable(HConnection connection,
byte[] tableName,
byte[] row,
int callTimeout) |
Modifier and Type | Method and Description |
---|---|
void |
afterCall() |
void |
beforeCall() |
void |
connect(boolean reload)
Connect to the server hosting region with row from tablename.
|
HRegionInfo |
getHRegionInfo() |
byte[] |
getRegionName()
Deprecated.
Just use
Object.toString() instead. |
byte[] |
getRow()
Deprecated.
Just use
Object.toString() instead. |
String |
getServerName()
Deprecated.
Just use
Object.toString() instead. |
T |
withoutRetries()
Run this instance against the server once.
|
T |
withRetries()
Run this instance with retries, timed waits,
and refinds of missing regions.
|
protected final HConnection connection
protected final byte[] tableName
protected final byte[] row
protected HRegionLocation location
protected HRegionInterface server
protected int callTimeout
protected long globalStartTime
protected long startTime
protected long endTime
protected static final int MIN_RPC_TIMEOUT
public ServerCallable(HConnection connection, byte[] tableName, byte[] row)
connection
- Connection to use.tableName
- Table name to which row
belongs.row
- The row we want in tableName
.public ServerCallable(HConnection connection, byte[] tableName, byte[] row, int callTimeout)
public void connect(boolean reload) throws IOException
reload
- Set this to true if connection should re-find the regionIOException
- epublic String getServerName()
Object.toString()
instead.public byte[] getRegionName()
Object.toString()
instead.public byte[] getRow()
Object.toString()
instead.public void beforeCall()
public void afterCall()
public T withRetries() throws IOException, RuntimeException
T
- the type of the return valueIOException
- if a remote or network exception occursRuntimeException
- other unspecified errorpublic T withoutRetries() throws IOException, RuntimeException
T
- the type of the return valueIOException
- if a remote or network exception occursRuntimeException
- other unspecified errorpublic HRegionInfo getHRegionInfo()
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.