use of com.google.protobuf.RpcController in project hbase by apache.
the class HBaseAdmin method coprocessorService.
@Override
public CoprocessorRpcChannel coprocessorService(final ServerName serverName) {
return new SyncCoprocessorRpcChannel() {
@Override
protected Message callExecService(RpcController controller, Descriptors.MethodDescriptor method, Message request, Message responsePrototype) throws IOException {
if (LOG.isTraceEnabled()) {
LOG.trace("Call: " + method.getName() + ", " + request.toString());
}
CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);
// TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller
// TODO: Make this same as RegionCoprocessorRpcChannel and MasterCoprocessorRpcChannel. They
// are all different though should do same thing; e.g. RpcChannel setup.
ClientProtos.ClientService.BlockingInterface stub = connection.getClient(serverName);
CoprocessorServiceResponse result;
try {
result = stub.execRegionServerService(connection.getRpcControllerFactory().newController(), csr);
return CoprocessorRpcUtils.getResponse(result, responsePrototype);
} catch (ServiceException e) {
throw ProtobufUtil.handleRemoteException(e);
}
}
};
}
use of com.google.protobuf.RpcController in project hbase by apache.
the class HBaseAdmin method coprocessorService.
@Override
public // Coprocessor Endpoint against the Master.
CoprocessorRpcChannel coprocessorService() {
return new SyncCoprocessorRpcChannel() {
@Override
protected Message callExecService(final RpcController controller, final Descriptors.MethodDescriptor method, final Message request, final Message responsePrototype) throws IOException {
if (LOG.isTraceEnabled()) {
LOG.trace("Call: " + method.getName() + ", " + request.toString());
}
// Try-with-resources so close gets called when we are done.
try (MasterCallable<CoprocessorServiceResponse> callable = new MasterCallable<CoprocessorServiceResponse>(connection, connection.getRpcControllerFactory()) {
@Override
protected CoprocessorServiceResponse rpcCall() throws Exception {
CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);
return this.master.execMasterService(getRpcController(), csr);
}
}) {
// TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller
callable.prepare(false);
int operationTimeout = connection.getConnectionConfiguration().getOperationTimeout();
CoprocessorServiceResponse result = callable.call(operationTimeout);
return CoprocessorRpcUtils.getResponse(result, responsePrototype);
}
}
};
}
Aggregations