org.apache.hadoop.hbase.ipc
Class ServerRpcController

java.lang.Object
  extended by org.apache.hadoop.hbase.ipc.ServerRpcController
All Implemented Interfaces:
com.google.protobuf.RpcController

@InterfaceAudience.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 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); }


Constructor Summary
ServerRpcController()
           
 
Method Summary
 void checkFailed()
          Throws an IOException back out if one is currently stored.
 String errorText()
           
 boolean failed()
           
 boolean failedOnException()
          Returns whether or not a server exception was generated in the prior RPC invocation.
 IOException getFailedOn()
          Returns any exception thrown during service method invocation, or null if no exception was thrown.
 boolean isCanceled()
           
 void notifyOnCancel(com.google.protobuf.RpcCallback<Object> objectRpcCallback)
           
 void reset()
           
 void setFailed(String message)
           
 void setFailedOn(IOException ioe)
          Sets an exception to be communicated back to the Service client.
 void startCancel()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerRpcController

public ServerRpcController()
Method Detail

reset

public void reset()
Specified by:
reset in interface com.google.protobuf.RpcController

failed

public boolean failed()
Specified by:
failed in interface com.google.protobuf.RpcController

errorText

public String errorText()
Specified by:
errorText in interface com.google.protobuf.RpcController

startCancel

public void startCancel()
Specified by:
startCancel in interface com.google.protobuf.RpcController

setFailed

public void setFailed(String message)
Specified by:
setFailed in interface com.google.protobuf.RpcController

isCanceled

public boolean isCanceled()
Specified by:
isCanceled in interface com.google.protobuf.RpcController

notifyOnCancel

public void notifyOnCancel(com.google.protobuf.RpcCallback<Object> objectRpcCallback)
Specified by:
notifyOnCancel in interface com.google.protobuf.RpcController

setFailedOn

public void setFailedOn(IOException ioe)
Sets an exception to be communicated back to the Service client.

Parameters:
ioe - the exception encountered during execution of the service method

getFailedOn

public IOException getFailedOn()
Returns any exception thrown during service method invocation, or null if no exception was thrown. This can be used by clients to receive exceptions generated by RPC calls, even when RpcCallbacks are used and no ServiceException is declared.


failedOnException

public boolean failedOnException()
Returns whether or not a server exception was generated in the prior RPC invocation.


checkFailed

public void checkFailed()
                 throws IOException
Throws an IOException back out if one is currently stored.

Throws:
IOException


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.