@Override public void setCallTimeout(int callTimeout) { delegate.setCallTimeout(callTimeout); }
static void resetController(HBaseRpcController controller, long timeoutNs) { controller.reset(); if (timeoutNs >= 0) { controller.setCallTimeout( (int) Math.min(Integer.MAX_VALUE, TimeUnit.NANOSECONDS.toMillis(timeoutNs))); } }
/** * Configure an hbase rpccontroller * @param controller to configure * @param channelOperationTimeout timeout for operation * @return configured controller */ static HBaseRpcController configureHBaseRpcController( RpcController controller, int channelOperationTimeout) { HBaseRpcController hrc; if (controller != null && controller instanceof HBaseRpcController) { hrc = (HBaseRpcController) controller; if (!hrc.hasCallTimeout()) { hrc.setCallTimeout(channelOperationTimeout); } } else { hrc = new HBaseRpcControllerImpl(); hrc.setCallTimeout(channelOperationTimeout); } return hrc; }
/** * Configure an rpc controller * @param controller to configure * @return configured rpc controller */ protected HBaseRpcController configureRpcController(RpcController controller) { HBaseRpcController hrc; // TODO: Ideally we should not use an RpcController other than HBaseRpcController at client // side. And now we may use ServerRpcController. if (controller != null && controller instanceof HBaseRpcController) { hrc = (HBaseRpcController) controller; if (!hrc.hasCallTimeout()) { hrc.setCallTimeout(rpcTimeout); } } else { hrc = new HBaseRpcControllerImpl(); hrc.setCallTimeout(rpcTimeout); } return hrc; } }
private HBaseRpcController getRpcController() { HBaseRpcController controller = this.rpcControllerFactory.newController(); controller.setCallTimeout((int) TimeUnit.NANOSECONDS.toMillis(connConf.getRpcTimeoutNs())); return controller; }
/** * Override that changes the {@link java.util.concurrent.Callable#call()} Exception from {@link Exception} to * {@link IOException}. It also does setup of an rpcController and calls through to the rpcCall() * method which callers are expected to implement. If rpcController is an instance of * PayloadCarryingRpcController, we will set a timeout on it. */ @Override // Same trick as in RegionServerCallable so users don't have to copy/paste so much boilerplate // and so we contain references to protobuf. We can't set priority on the rpcController as // we do in RegionServerCallable because we don't always have a Table when we call. public V call(int callTimeout) throws IOException { try { if (this.rpcController != null) { this.rpcController.reset(); this.rpcController.setCallTimeout(callTimeout); } return rpcCall(); } catch (Exception e) { throw ProtobufUtil.handleRemoteException(e); } }
/** * Override that changes Exception from {@link Exception} to {@link IOException}. It also does * setup of an rpcController and calls through to the unimplemented * call(PayloadCarryingRpcController) method; implement this method to add your rpc invocation. */ @Override // Same trick as in RegionServerCallable so users don't have to copy/paste so much boilerplate // and so we contain references to protobuf. We can't set priority on the rpcController as // we do in RegionServerCallable because we don't always have a Table when we call. public T call(int callTimeout) throws IOException { this.controller = rpcControllerFactory.newController(); this.controller.setPriority(this.tableName); this.controller.setCallTimeout(callTimeout); try { return call(this.controller); } catch (Exception e) { throw ProtobufUtil.handleRemoteException(e); } }
@Override // TODO: Very like the super class implemenation. Can we shrink this down? protected Result rpcCall() throws Exception { if (getRpcController().isCanceled()) return null; if (Thread.interrupted()) { throw new InterruptedIOException(); } byte[] reg = location.getRegionInfo().getRegionName(); ClientProtos.GetRequest request = RequestConverter.buildGetRequest(reg, get); HBaseRpcController hrc = (HBaseRpcController)getRpcController(); hrc.reset(); hrc.setCallTimeout(rpcTimeout); hrc.setPriority(tableName); ClientProtos.GetResponse response = getStub().get(hrc, request); if (response == null) { return null; } return ProtobufUtil.toResult(response.getResult(), hrc.cellScanner()); } }
controller.setCallTimeout(call.getTimeout()); Message result = call.getService().callBlockingMethod(md, controller, param); long receiveTime = call.getReceiveTime();
/** * Override that changes call Exception from {@link Exception} to {@link IOException}. * Also does set up of the rpcController. */ @Override public T call(int callTimeout) throws IOException { try { // Iff non-null and an instance of a SHADED rpcController, do config! Unshaded -- i.e. // com.google.protobuf.RpcController or null -- will just skip over this config. if (getRpcController() != null) { RpcController shadedRpcController = (RpcController)getRpcController(); // Do a reset to clear previous states, such as CellScanner. shadedRpcController.reset(); if (shadedRpcController instanceof HBaseRpcController) { HBaseRpcController hrc = (HBaseRpcController)getRpcController(); // If it is an instance of HBaseRpcController, we can set priority on the controller based // off the tableName. Set call timeout too. hrc.setPriority(tableName); hrc.setPriority(priority); hrc.setCallTimeout(callTimeout); } } return rpcCall(); } catch (Exception e) { throw ProtobufUtil.handleRemoteException(e); } }
@Override public void setCallTimeout(int callTimeout) { delegate.setCallTimeout(callTimeout); }
for (int i = 0; i < 10; i++) { HBaseRpcController pcrc = new HBaseRpcControllerImpl(); pcrc.setCallTimeout(timeout); BlockingRpcCallback<EmptyResponseProto> callback = new BlockingRpcCallback<>(); stub.pause(pcrc, PauseRequestProto.newBuilder().setMs(ms).build(), callback);
for (int i = 0; i < 10; i++) { pcrc.reset(); pcrc.setCallTimeout(timeout); long startTime = System.nanoTime(); try {
static void resetController(HBaseRpcController controller, long timeoutNs) { controller.reset(); if (timeoutNs >= 0) { controller.setCallTimeout( (int) Math.min(Integer.MAX_VALUE, TimeUnit.NANOSECONDS.toMillis(timeoutNs))); } }
/** * Configure an hbase rpccontroller * @param controller to configure * @param channelOperationTimeout timeout for operation * @return configured controller */ static HBaseRpcController configureHBaseRpcController( RpcController controller, int channelOperationTimeout) { HBaseRpcController hrc; if (controller != null && controller instanceof HBaseRpcController) { hrc = (HBaseRpcController) controller; if (!hrc.hasCallTimeout()) { hrc.setCallTimeout(channelOperationTimeout); } } else { hrc = new HBaseRpcControllerImpl(); hrc.setCallTimeout(channelOperationTimeout); } return hrc; }
/** * Configure an rpc controller * @param controller to configure * @return configured rpc controller */ protected HBaseRpcController configureRpcController(RpcController controller) { HBaseRpcController hrc; // TODO: Ideally we should not use an RpcController other than HBaseRpcController at client // side. And now we may use ServerRpcController. if (controller != null && controller instanceof HBaseRpcController) { hrc = (HBaseRpcController) controller; if (!hrc.hasCallTimeout()) { hrc.setCallTimeout(rpcTimeout); } } else { hrc = new HBaseRpcControllerImpl(); hrc.setCallTimeout(rpcTimeout); } return hrc; } }
private HBaseRpcController getRpcController() { HBaseRpcController controller = this.rpcControllerFactory.newController(); controller.setCallTimeout((int) TimeUnit.NANOSECONDS.toMillis(connConf.getRpcTimeoutNs())); return controller; }
/** * Override that changes the {@link java.util.concurrent.Callable#call()} Exception from {@link Exception} to * {@link IOException}. It also does setup of an rpcController and calls through to the rpcCall() * method which callers are expected to implement. If rpcController is an instance of * PayloadCarryingRpcController, we will set a timeout on it. */ @Override // Same trick as in RegionServerCallable so users don't have to copy/paste so much boilerplate // and so we contain references to protobuf. We can't set priority on the rpcController as // we do in RegionServerCallable because we don't always have a Table when we call. public V call(int callTimeout) throws IOException { try { if (this.rpcController != null) { this.rpcController.reset(); this.rpcController.setCallTimeout(callTimeout); } return rpcCall(); } catch (Exception e) { throw ProtobufUtil.handleRemoteException(e); } }
/** * Override that changes Exception from {@link Exception} to {@link IOException}. It also does * setup of an rpcController and calls through to the unimplemented * call(PayloadCarryingRpcController) method; implement this method to add your rpc invocation. */ @Override // Same trick as in RegionServerCallable so users don't have to copy/paste so much boilerplate // and so we contain references to protobuf. We can't set priority on the rpcController as // we do in RegionServerCallable because we don't always have a Table when we call. public T call(int callTimeout) throws IOException { this.controller = rpcControllerFactory.newController(); this.controller.setPriority(this.tableName); this.controller.setCallTimeout(callTimeout); try { return call(this.controller); } catch (Exception e) { throw ProtobufUtil.handleRemoteException(e); } }
@Override // TODO: Very like the super class implemenation. Can we shrink this down? protected Result rpcCall() throws Exception { if (getRpcController().isCanceled()) return null; if (Thread.interrupted()) { throw new InterruptedIOException(); } byte[] reg = location.getRegionInfo().getRegionName(); ClientProtos.GetRequest request = RequestConverter.buildGetRequest(reg, get); HBaseRpcController hrc = (HBaseRpcController)getRpcController(); hrc.reset(); hrc.setCallTimeout(rpcTimeout); hrc.setPriority(tableName); ClientProtos.GetResponse response = getStub().get(hrc, request); if (response == null) { return null; } return ProtobufUtil.toResult(response.getResult(), hrc.cellScanner()); } }