@Override public TestResponse test(RpcController rpcController, TestArg arg) throws ServiceException { LOG.info("In faulty test, delay=" + arg.getDelay()); if (!arg.getDelay()) return TestResponse.newBuilder().setResponse(UNDELAYED).build(); Delayable call = RpcServer.getCurrentCall(); call.startDelay(true); LOG.info("In faulty test, delaying"); try { call.endDelayThrowing(new Exception("Something went wrong")); } catch (IOException e) { e.printStackTrace(); } // Client will receive the Exception, not this value. return TestResponse.newBuilder().setResponse(DELAYED).build(); }
@Override public void run() { Integer result; try { result = new Integer(stub.test(null, TestArg.newBuilder().setDelay(delay).build()). getResponse()); } catch (ServiceException e) { throw new RuntimeException(e); } if (results != null) { synchronized (results) { results.add(result); } } }
@Override public void run() { try { Integer result = new Integer(server.test(TestArg.newBuilder() .setDelay(delay).build()).getResponse()); if (results != null) { synchronized (results) { results.add(result); } } } catch (Exception e) { fail("Unexpected exception: "+e.getMessage()); } }
@Override public TestResponse test(TestArg arg) { if (!arg.getDelay()) return TestResponse.newBuilder().setResponse(UNDELAYED).build(); Delayable call = HBaseServer.getCurrentCall(); call.startDelay(true); try { call.endDelayThrowing(new Exception("Something went wrong")); } catch (IOException e) { e.printStackTrace(); } // Client will receive the Exception, not this value. return TestResponse.newBuilder().setResponse(DELAYED).build(); }
TestResponse test(TestArg delay);