List of usage examples for org.apache.http.nio NHttpConnection CLOSING
int CLOSING
To view the source code for org.apache.http.nio NHttpConnection CLOSING.
Click Source Link
From source file:org.apache.http.impl.nio.client.NHttpClientProtocolHandler.java
public void timeout(final NHttpClientConnection conn) { HttpContext context = conn.getContext(); HttpExchange httpexchange = getHttpExchange(context); HttpAsyncExchangeHandler<?> handler = getHandler(context); if (this.log.isDebugEnabled()) { this.log.debug("Timeout " + formatState(conn, httpexchange)); }/*from w w w . j a v a 2 s .com*/ try { if (httpexchange.getRequestState() == MessageState.ACK) { continueRequest(conn, httpexchange); httpexchange.setRequestState(MessageState.BODY_STREAM); } else { if (conn.getStatus() == NHttpConnection.ACTIVE) { conn.close(); if (conn.getStatus() == NHttpConnection.CLOSING) { // Give the connection some grace time to // close itself nicely conn.setSocketTimeout(250); } } else { conn.shutdown(); } } } catch (IOException ex) { if (this.log.isDebugEnabled()) { this.log.debug("I/O error: " + ex.getMessage(), ex); } shutdownConnection(conn); handler.failed(ex); } }