Gary Helmling created HBASE-6995:
------------------------------------

             Summary: Expose PB BlockingInterface implementations for 
coprocessor endpoints
                 Key: HBASE-6995
                 URL: https://issues.apache.org/jira/browse/HBASE-6995
             Project: HBase
          Issue Type: Improvement
          Components: Coprocessors
    Affects Versions: 0.96.0
            Reporter: Gary Helmling


This is a follow on to HBASE-5448 to improve the semantics exposed to clients 
for multi-region coprocessor endpoint RPCs.

As discussed over in HBASE-6785 (the conversion of AggregateProtocol to PB 
service), the currently exposed PB services result in a lot of boilerplate code 
on the client side.  For example, duplication of code like:
{code:java}
AggregateResponse response = rpcCallback.get();
if (controller.failedOnException()) {
  throw controller.getFailedOn();
}
{code}

This also forces clients to do explicit handling to propagate exceptions.  It 
seems like we could completely avoid the duplication and exception throwing if 
we provided a way for clients to use BlockingService instances.  In that case, 
sections like:

{code:java}
ServerRpcController controller = new ServerRpcController();
BlockingRpcCallback<AggregateResponse> rpcCallback =
    new BlockingRpcCallback<AggregateResponse>();
instance.getMedian(controller, requestArg, rpcCallback);
AggregateResponse response = rpcCallback.get();
if (controller.failedOnException()) {
  throw controller.getFailedOn();
}
{code}

could become something like:
{code:java}
ServerRpcController controller = new ServerRpcController();
AggregateResponse response = instance.getMedian(controller, requestArg);
{code}

where the call to {{instance.getMedian()}} through the blocking interface would 
wrap any encountered {{IOException}} in a {{ServiceException}}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to