scan.getStopRow(), (ExportProtos.ExportService service) -> { ServerRpcController controller = new ServerRpcController(); Map<byte[], ExportProtos.ExportResponse> rval = new TreeMap<>(Bytes.BYTES_COMPARATOR); CoprocessorRpcUtils.BlockingRpcCallback<ExportProtos.ExportResponse> rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback<>(); service.export(controller, request, rpcCallback); if (controller.failedOnException()) { throw controller.getFailedOn();
/** * Stores an exception encountered during RPC invocation so it can be passed back * through to the client. * @param controller the controller instance provided by the client when calling the service * @param ioe the exception encountered */ public static void setControllerException(RpcController controller, IOException ioe) { if (controller == null) { return; } if (controller instanceof org.apache.hadoop.hbase.ipc.ServerRpcController) { ((ServerRpcController)controller).setFailedOn(ioe); } else { controller.setFailed(StringUtils.stringifyException(ioe)); } }
/** * Sets an exception to be communicated back to the {@link com.google.protobuf.Service} client. * @param ioe the exception encountered during execution of the service method */ public void setFailedOn(IOException ioe) { serviceException = ioe; setFailed(StringUtils.stringifyException(ioe)); }
/** * Throws an IOException back out if one is currently stored. */ public void checkFailed() throws IOException { if (failedOnException()) { throw getFailedOn(); } } }
@Override public AuthenticationProtos.GetAuthenticationTokenResponse getAuthenticationToken( RpcController controller, AuthenticationProtos.GetAuthenticationTokenRequest request) throws ServiceException { LOG.debug("Authentication token request from " + RpcServer.getRequestUserName().orElse(null)); // Ignore above passed in controller -- it is always null ServerRpcController serverController = new ServerRpcController(); final NonShadedBlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse> callback = new NonShadedBlockingRpcCallback<>(); getAuthenticationToken(null, request, callback); try { serverController.checkFailed(); return callback.get(); } catch (IOException ioe) { throw new ServiceException(ioe); } }
private <R> R blockOnResponse(BlockingRpcCallback<R> done, ServerRpcController controller) throws IOException { R response = done.get(); if(controller.failedOnException()) { throw controller.getFailedOn(); } if(controller.failed()) { String error = controller.errorText(); if(error == null) { error = "Server indicated failure but error text was empty"; } throw new RuntimeException(error); } return response; } private <R> R call(Batch.Call<RevisionManagerEndpointService, R> callable) throws IOException {
/** * Retreivies exception stored during RPC invocation. * @param controller the controller instance provided by the client when calling the service * @return exception if any, or null; Will return DoNotRetryIOException for string represented * failure causes in controller. */ @Nullable public static IOException getControllerException(RpcController controller) throws IOException { if (controller == null || !controller.failed()) { return null; } if (controller instanceof ServerRpcController) { return ((ServerRpcController)controller).getFailedOn(); } return new DoNotRetryIOException(controller.errorText()); } }
rpcPreCheck("execMasterService"); try { ServerRpcController execController = new ServerRpcController(); ClientProtos.CoprocessorServiceCall call = request.getCall(); String serviceName = call.getServiceName(); if (execController.getFailedOn() != null) { throw execController.getFailedOn();
private com.google.protobuf.Message execServiceOnRegion(HRegion region, final ClientProtos.CoprocessorServiceCall serviceCall) throws IOException { // ignore the passed in controller (from the serialized call) ServerRpcController execController = new ServerRpcController(); return region.execService(execController, serviceCall); }
@Override public boolean failed() { return (failedOnException() || errorMessage != null); }
/** * Throws an IOException back out if one is currently stored. */ public void checkFailed() throws IOException { if (failedOnException()) { throw getFailedOn(); } } }
/** * Retreivies exception stored during RPC invocation. * @param controller the controller instance provided by the client when calling the service * @return exception if any, or null; Will return DoNotRetryIOException for string represented * failure causes in controller. */ @Nullable public static IOException getControllerException(RpcController controller) throws IOException { if (controller != null && controller.failed()) { if (controller instanceof ServerRpcController) { return ((ServerRpcController)controller).getFailedOn(); } else { return new DoNotRetryIOException(controller.errorText()); } } return null; }
try { master.checkInitialized(); ServerRpcController execController = new ServerRpcController(); Message execResult = responseBuilder.build(); if (execController.getFailedOn() != null) { throw execController.getFailedOn();
final CoprocessorServiceRequest serviceRequest) throws ServiceException { try { ServerRpcController serviceController = new ServerRpcController(); CoprocessorServiceCall call = serviceRequest.getCall(); String serviceName = call.getServiceName();
@Override public boolean failed() { return (failedOnException() || errorMessage != null); }
@Override public AuthenticationProtos.WhoAmIResponse whoAmI( RpcController controller, AuthenticationProtos.WhoAmIRequest request) throws ServiceException { LOG.debug("whoAmI() request from " + RpcServer.getRequestUserName().orElse(null)); // Ignore above passed in controller -- it is always null ServerRpcController serverController = new ServerRpcController(); NonShadedBlockingRpcCallback<AuthenticationProtos.WhoAmIResponse> callback = new NonShadedBlockingRpcCallback<>(); whoAmI(null, request, callback); try { serverController.checkFailed(); return callback.get(); } catch (IOException ioe) { throw new ServiceException(ioe); } }
public void cleanupBulkLoad(final String bulkToken) throws IOException { try { CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW); SecureBulkLoadProtos.SecureBulkLoadService instance = ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel); ServerRpcController controller = new ServerRpcController(); CoprocessorRpcUtils.BlockingRpcCallback<CleanupBulkLoadResponse> rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback<>(); CleanupBulkLoadRequest request = CleanupBulkLoadRequest.newBuilder() .setBulkToken(bulkToken).build(); instance.cleanupBulkLoad(controller, request, rpcCallback); if (controller.failedOnException()) { throw controller.getFailedOn(); } } catch (Throwable throwable) { throw new IOException(throwable); } }
/** * Throws an IOException back out if one is currently stored. */ public void checkFailed() throws IOException { if (failedOnException()) { throw getFailedOn(); } } }
/** * Retreivies exception stored during RPC invocation. * @param controller the controller instance provided by the client when calling the service * @return exception if any, or null; Will return DoNotRetryIOException for string represented * failure causes in controller. */ @Nullable public static IOException getControllerException(RpcController controller) throws IOException { if (controller != null && controller.failed()) { if (controller instanceof ServerRpcController) { return ((ServerRpcController)controller).getFailedOn(); } else { return new DoNotRetryIOException(controller.errorText()); } } return null; }
try { final RpcController controller = new ServerRpcController(); table.coprocessorService(TestRpcServiceProtos.TestProtobufRpcProto.class, ROWS[0], ROWS[ROWS.length - 1],