Package org.apache.hadoop.hbase.ipc
Class ServerRpcController
java.lang.Object
org.apache.hadoop.hbase.ipc.ServerRpcController
- All Implemented Interfaces:
com.google.protobuf.RpcController
@Private
public class ServerRpcController
extends Object
implements com.google.protobuf.RpcController
Used for server-side protobuf RPC service invocations. This handler allows invocation exceptions
to easily be passed through to the RPC server from coprocessor
Service implementations.
When implementing Service defined methods, coprocessor endpoints can
use the following pattern to pass exceptions back to the RPC client:
public void myMethod(RpcController controller, MyRequest request,
RpcCallback<MyResponse> done) {
MyResponse response = null;
try {
// do processing
response = MyResponse.getDefaultInstance(); // or use a new builder to populate the response
} catch (IOException ioe) {
// pass exception back up
ResponseConverter.setControllerException(controller, ioe);
}
done.run(response);
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate IOExceptionThe exception thrown withinService.callMethod(com.google.protobuf.Descriptors.MethodDescriptor, RpcController, com.google.protobuf.Message, RpcCallback)if any. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThrows an IOException back out if one is currently stored.booleanfailed()booleanReturns whether or not a server exception was generated in the prior RPC invocation.Returns any exception thrown during service method invocation, ornullif no exception was thrown.booleanvoidnotifyOnCancel(com.google.protobuf.RpcCallback<Object> objectRpcCallback) voidreset()voidvoidsetFailedOn(IOException ioe) Sets an exception to be communicated back to theServiceclient.void
-
Field Details
-
serviceException
The exception thrown withinService.callMethod(com.google.protobuf.Descriptors.MethodDescriptor, RpcController, com.google.protobuf.Message, RpcCallback)if any. -
errorMessage
-
-
Constructor Details
-
ServerRpcController
public ServerRpcController()
-
-
Method Details
-
reset
- Specified by:
resetin interfacecom.google.protobuf.RpcController
-
failed
- Specified by:
failedin interfacecom.google.protobuf.RpcController
-
errorText
- Specified by:
errorTextin interfacecom.google.protobuf.RpcController
-
startCancel
- Specified by:
startCancelin interfacecom.google.protobuf.RpcController
-
setFailed
- Specified by:
setFailedin interfacecom.google.protobuf.RpcController
-
isCanceled
- Specified by:
isCanceledin interfacecom.google.protobuf.RpcController
-
notifyOnCancel
- Specified by:
notifyOnCancelin interfacecom.google.protobuf.RpcController
-
setFailedOn
Sets an exception to be communicated back to theServiceclient.- Parameters:
ioe- the exception encountered during execution of the service method
-
getFailedOn
Returns any exception thrown during service method invocation, ornullif no exception was thrown. This can be used by clients to receive exceptions generated by RPC calls, even whenRpcCallbacks are used and noServiceExceptionis declared. -
failedOnException
Returns whether or not a server exception was generated in the prior RPC invocation. -
checkFailed
Throws an IOException back out if one is currently stored.- Throws:
IOException
-