@Override public Response invoke(Invocation request) { // Doing blocking requests with an async httpclient is quite useless. // But it is better to use the same httpclient in any case just for sharing+configuring only one connectionpool. Future<ClientResponse> future = submit((ClientInvocation)request, false, null, new ResultExtractor<ClientResponse>() { @Override public ClientResponse extractResult(ClientResponse response) { return response; } }); try { return future.get(); } catch (InterruptedException e) { future.cancel(true); throw clientException(e, null); } catch (ExecutionException e) { throw clientException(e.getCause(), null); } }
@Override public ClientResponse invoke(ClientInvocation request) { // Doing blocking requests with an async httpclient is quite useless. // But it is better to use the same httpclient in any case just for sharing+configuring only one connectionpool. Future<ClientResponse> future = submit(request, false, null, new ResultExtractor<ClientResponse>() { @Override public ClientResponse extractResult(ClientResponse response) { return response; } }); try { return future.get(); } catch (InterruptedException e) { future.cancel(true); throw clientException(e, null); } catch (ExecutionException e) { throw clientException(e.getCause(), null); } }
@Override public ClientResponse invoke(ClientInvocation request) { // Doing blocking requests with an async httpclient is quite useless. // But it is better to use the same httpclient in any case just for sharing+configuring only one connectionpool. Future<ClientResponse> future = submit(request, false, null, new ResultExtractor<ClientResponse>() { @Override public ClientResponse extractResult(ClientResponse response) { return response; } }); try { return future.get(); } catch (InterruptedException e) { future.cancel(true); throw clientException(e, null); } catch (ExecutionException e) { throw clientException(e.getCause(), null); } }