private static <ReqT, RespT, OutputT> OutputT getBlockingResult( AbstractRetryingRpcListener<ReqT, RespT, OutputT> listener) { try { listener.start(); return listener.getCompletionFuture().get(); } catch (InterruptedException e) { listener.cancel(); throw Status.CANCELLED.withCause(e).asRuntimeException(); } catch (ExecutionException e) { listener.cancel(); throw Status.fromThrowable(e).asRuntimeException(); } }
private static <ReqT, RespT, OutputT> ListenableFuture<OutputT> getCompletionFuture( AbstractRetryingRpcListener<ReqT, RespT, OutputT> listener) { listener.start(); return listener.getCompletionFuture(); }