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

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

public abstract class ServerCallable<T>
extends Object
implements Callable<T>

Abstract class that implements 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().

See Also:
HConnection.getRegionServerWithoutRetries(ServerCallable)

Field Summary
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 Summary
ServerCallable(HConnection connection, byte[] tableName, byte[] row)
           
ServerCallable(HConnection connection, byte[] tableName, byte[] row, int callTimeout)
           
 
Method Summary
 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.
 
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 byte[] tableName

row

protected final byte[] row

location

protected HRegionLocation location

server

protected HRegionInterface server

callTimeout

protected int callTimeout

globalStartTime

protected long globalStartTime

startTime

protected long startTime

endTime

protected long endTime

MIN_RPC_TIMEOUT

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

ServerCallable

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

ServerCallable

public ServerCallable(HConnection connection,
                      byte[] tableName,
                      byte[] row,
                      int callTimeout)
Method Detail

connect

public void connect(boolean reload)
             throws IOException
Connect to the server hosting region with row from tablename.

Parameters:
reload - Set this to true if connection should re-find the region
Throws:
IOException - e

getServerName

public String getServerName()
Deprecated. Just use Object.toString() instead.

Returns:
the server name

getRegionName

public byte[] getRegionName()
Deprecated. Just use Object.toString() instead.

Returns:
the region name

getRow

public byte[] getRow()
Deprecated. Just use Object.toString() instead.

Returns:
the row

beforeCall

public void beforeCall()

afterCall

public void afterCall()

withRetries

public T withRetries()
              throws IOException,
                     RuntimeException
Run this instance with retries, timed waits, and refinds of missing regions.

Type Parameters:
T - the type of the return value
Returns:
an object of type T
Throws:
IOException - if a remote or network exception occurs
RuntimeException - other unspecified error

withoutRetries

public T withoutRetries()
                 throws IOException,
                        RuntimeException
Run this instance against the server once.

Type Parameters:
T - the type of the return value
Returns:
an object of type T
Throws:
IOException - if a remote or network exception occurs
RuntimeException - other unspecified error

getHRegionInfo

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


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