Package org.apache.hadoop.hbase.ipc
Interface HBaseRpcController
- All Superinterfaces:
CellScannable,ExtendedCellScannable,org.apache.hbase.thirdparty.com.google.protobuf.RpcController
- All Known Implementing Classes:
DelegatingHBaseRpcController,HBaseRpcControllerImpl
@LimitedPrivate({"Coprocesssor","Phoenix","Replication"})
@Evolving
public interface HBaseRpcController
extends org.apache.hbase.thirdparty.com.google.protobuf.RpcController, ExtendedCellScannable
Optionally carries Cells across the proxy/service interface down into ipc. On its way out it
optionally carries a set of result Cell data. We stick the Cells here when we want to avoid
having to protobuf them (for performance reasons). This class is used ferrying data across the
proxy/protobuf service chasm. Also does call timeout and on client-side, carries the target
RegionInfo we're making the call against if relevant (useful adding info to exceptions and logs).
Used by client and server ipc'ing.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionintReturn the failed exception, null if not failed.intReturns The priority of this requestdefault RegionInfoReturns Target Region's RegionInfo or null if not available or pertinent.Get the map of request attributesdefault TableNameReturns Region's table name or null if not available or pertinent.booleandefault booleanReturns True if this Controller is carrying the RPC target Region's RegionInfo.voidnotifyOnCancel(org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<Object> callback) A little different from the basic RpcController: You can register multiple callbacks to anHBaseRpcController. The callback will not be called if the rpc call is finished without any cancellation. You can call me at client side also.voidnotifyOnCancel(org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<Object> callback, HBaseRpcController.CancellationCallback action) If not cancelled, add the callback to cancellation callback list.voidsetCallTimeout(int callTimeout) voidsetCellScanner(ExtendedCellScanner cellScanner) Only used to send cells to rpc server, the returned cells should be set bysetDone(ExtendedCellScanner).voidsetDone(ExtendedCellScanner cellScanner) IMPORTANT: always call this method if the call finished without any exception to tell theHBaseRpcControllerthat we are done.voidSet failed with an exception to pass on.voidsetPriority(int priority) Deprecated.Since 3.0.0, will be remove in 4.0.0.default voidsetPriority(int priority, @Nullable TableName tableName) Set the priority for this rpc request.voidsetPriority(TableName tn) Deprecated.Since 3.0.0, will be remove in 4.0.0.voidsetRequestAttributes(Map<String, byte[]> requestAttributes) Set the map of request attributesdefault voidsetTableName(TableName tableName) Sets Region's table name.Methods inherited from interface org.apache.hadoop.hbase.ExtendedCellScannable
cellScannerMethods inherited from interface org.apache.hbase.thirdparty.com.google.protobuf.RpcController
errorText, failed, isCanceled, reset, setFailed, startCancel
-
Method Details
-
setCellScanner
Only used to send cells to rpc server, the returned cells should be set bysetDone(ExtendedCellScanner). -
setPriority
Deprecated.Since 3.0.0, will be remove in 4.0.0. UsesetPriority(int, TableName)instead.Set the priority for this operation.- Parameters:
priority- Priority for this request; should fall roughly in the rangeHConstants.NORMAL_QOStoHConstants.HIGH_QOS
-
setPriority
Deprecated.Since 3.0.0, will be remove in 4.0.0. UsesetPriority(int, TableName)instead.Set the priority for this operation.- Parameters:
tn- Set priority based off the table we are going against.
-
setPriority
Set the priority for this rpc request.For keep compatibility, here we declare the default method where we call
setPriority(int)and thensetPriority(TableName).The default implementation in HBase follow the below rules:
- If user set a priority explicitly, then just use it.
- For system table, use
HConstants.SYSTEMTABLE_QOS. - For other tables, use
HConstants.NORMAL_QOS.
- Parameters:
priority- the priority set by user, can beHConstants.PRIORITY_UNSET.tableName- the table we operate on, can be null.
-
getPriority
int getPriority()Returns The priority of this request -
getCallTimeout
int getCallTimeout() -
setCallTimeout
-
hasCallTimeout
boolean hasCallTimeout() -
getRequestAttributes
Map<String,byte[]> getRequestAttributes()Get the map of request attributes -
setRequestAttributes
Set the map of request attributes -
setFailed
Set failed with an exception to pass on. For use in async rpc clients- Parameters:
e- exception to set with
-
getFailed
Return the failed exception, null if not failed. -
setDone
IMPORTANT: always call this method if the call finished without any exception to tell theHBaseRpcControllerthat we are done. -
notifyOnCancel
A little different from the basic RpcController:- You can register multiple callbacks to an
HBaseRpcController. - The callback will not be called if the rpc call is finished without any cancellation.
- You can call me at client side also.
- Specified by:
notifyOnCancelin interfaceorg.apache.hbase.thirdparty.com.google.protobuf.RpcController
- You can register multiple callbacks to an
-
notifyOnCancel
void notifyOnCancel(org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<Object> callback, HBaseRpcController.CancellationCallback action) throws IOException If not cancelled, add the callback to cancellation callback list. And then execute the action with the cancellation state as a parameter. The implementation should guarantee that the cancellation state does not change during this call.- Throws:
IOException
-
hasRegionInfo
Returns True if this Controller is carrying the RPC target Region's RegionInfo. -
getRegionInfo
Returns Target Region's RegionInfo or null if not available or pertinent. -
setTableName
Sets Region's table name. -
getTableName
Returns Region's table name or null if not available or pertinent.
-