@Override public void onThrowable(final Throwable t) { //nginx does not send status code so this http client explodes final boolean maybeUriTooLongErrorFromNgingx = t.getMessage().contains("invalid version format: <HTML>"); final String message = maybeUriTooLongErrorFromNgingx ? "There is a problem, maybe the request URI was too long due to an inefficient query." : "The underlying HTTP client detected a problem."; future.completeExceptionally(new HttpException(message, t)); super.onThrowable(t); } });
@Override public void onThrowable(final Throwable t) { //nginx does not send status code so this http client explodes final boolean maybeUriTooLongErrorFromNgingx = t.getMessage().contains("invalid version format: <HTML>"); final String message = maybeUriTooLongErrorFromNgingx ? "There is a problem, maybe the request URI was too long due to an inefficient query." : "The underlying HTTP client detected a problem."; future.completeExceptionally(new HttpException(message, t)); super.onThrowable(t); } });
@Override public void onThrowable(Throwable t) { counts.incrementAndGet(); super.onThrowable(t); } });
@Override public void onThrowable(Throwable t) { times[1] = millisTime(); super.onThrowable(t); } });
public synchronized void executeRequest(final File file, final AsyncCompletionHandler<Response> completionHandler) { if (isClosed.get()) { return; } if (client == null || client.isClosed()) { client = createClient(); } final Request request = createPostRequest(file); try { client.executeRequest(request, completionHandler); } catch (Exception e) { // Recycle the client on IOException and RuntimeExceptions client.close(); client = createClient(); completionHandler.onThrowable(e); } }