private static void closeConnection(final HttpClientConnection conn) { try { conn.close(); } catch (final IOException ignore) { } }
@Override public boolean isClosed() { final HttpClientConnection conn = getConnection(); return !conn.isOpen(); }
@Override public boolean isStale() { final HttpClientConnection conn = getConnection(); if (conn != null) { return conn.isStale(); } else { return true; } }
context.setAttribute(HttpCoreContext.HTTP_REQ_SENT, Boolean.FALSE); conn.sendRequestHeader(request); if (request instanceof HttpEntityEnclosingRequest) { !ver.lessEquals(HttpVersion.HTTP_1_0)) { conn.flush(); if (conn.isResponseAvailable(this.waitForContinue)) { response = conn.receiveResponseHeader(); if (canResponseHaveBody(request, response)) { conn.receiveResponseEntity(response); conn.sendRequestEntity((HttpEntityEnclosingRequest) request); conn.flush(); context.setAttribute(HttpCoreContext.HTTP_REQ_SENT, Boolean.TRUE); return response;
if (managedConn.isOpen()) { this.log.debug("Stale connection check"); if (managedConn.isStale()) { this.log.debug("Stale connection detected"); managedConn.close(); if (!managedConn.isOpen()) { this.log.debug("Opening connection " + route); try { managedConn.setSocketTimeout(timeout); EntityUtils.consume(entity); } else { managedConn.close(); if (proxyAuthState.getState() == AuthProtocolState.SUCCESS && proxyAuthState.getAuthScheme() != null
response = conn.receiveResponseHeader(); if (canResponseHaveBody(request, response)) { conn.receiveResponseEntity(response);
if (!managedConn.isOpen()) { final int timeout = config.getConnectTimeout(); this.connManager.connect( managedConn.setSocketTimeout(timeout);
@Override public void close() { try { this.getConnection().close(); } catch (final IOException ignore) { } }
@Override protected boolean validate(final BasicPoolEntry entry) { return !entry.getConnection().isStale(); }
@Override public boolean isClosed() { return !this.getConnection().isOpen(); }
public void closeConnection() throws IOException { final HttpClientConnection conn = getConnection(); conn.close(); }
@Override public void releaseConnection() { synchronized (this.managedConn) { if (this.released) { return; } this.released = true; if (this.reusable) { this.manager.releaseConnection(this.managedConn, this.state, this.validDuration, this.tunit); } else { try { this.managedConn.close(); log.debug("Connection discarded"); } catch (final IOException ex) { if (this.log.isDebugEnabled()) { this.log.debug(ex.getMessage(), ex); } } finally { this.manager.releaseConnection( this.managedConn, null, 0, TimeUnit.MILLISECONDS); } } } }