List of usage examples for org.apache.http.impl.nio.reactor ExceptionEvent getTimestamp
public Date getTimestamp()
From source file:co.paralleluniverse.fibers.httpclient.FiberHttpClient.java
@Override @Suspendable//from www . j a va 2 s . c o m protected final CloseableHttpResponse doExecute(final HttpHost target, final HttpRequest request, final HttpContext context) throws IOException, ClientProtocolException { try { for (int executionCount = 0;; executionCount++) { try { final HttpResponse response = new AsyncHttpReq() { @Override protected void requestAsync() { client.execute(target, request, context, this); } }.run(); return new CloseableHttpResponseWrapper(response); } catch (IOException ex) { if (httpRequestRetryHandler != null && httpRequestRetryHandler.retryRequest(ex, executionCount, context)) { if (this.log.isInfoEnabled()) { this.log.info("I/O exception (" + ex.getClass().getName() + ") caught when processing request: " + ex.getMessage()); } if (this.log.isDebugEnabled()) { this.log.debug(ex.getMessage(), ex); } this.log.info("Retrying request"); } else throw ex; } } } catch (SuspendExecution e) { throw new AssertionError(); } catch (IllegalStateException ise) { if (ioreactor != null) { final List<ExceptionEvent> events = ioreactor.getAuditLog(); if (events != null) { for (ExceptionEvent event : events) { final StringBuilder msg = new StringBuilder(); msg.append("Apache Async HTTP Client I/O Reactor exception timestamp: "); msg.append(event.getTimestamp()); if (event.getCause() != null) { msg.append(", cause stacktrace:\n"); final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); ise.getCause().printStackTrace(pw); msg.append(sw.toString()); } this.log.fatal(msg.toString()); } } } throw ise; } }