public HttpResponse receiveResponseHeader() throws HttpException, IOException { assertNotAborted(); OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); unmarkReusable(); return conn.receiveResponseHeader(); }
/** * Detaches this adapter from the wrapped connection. * This adapter becomes useless. */ @Override protected void detach() { super.detach(); poolEntry = null; }
public SSLSession getSSLSession() { OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); if (!isOpen()) return null; SSLSession result = null; Socket sock = conn.getSocket(); if (sock instanceof SSLSocket) { result = ((SSLSocket)sock).getSession(); } return result; }
public void flush() throws IOException { assertNotAborted(); OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); conn.flush(); }
public void receiveResponseEntity(final HttpResponse response) throws HttpException, IOException { final OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); unmarkReusable(); conn.receiveResponseEntity(response); }
public int getSocketTimeout() { OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); return conn.getSocketTimeout(); }
public void abortConnection() { if (aborted) { return; } aborted = true; unmarkReusable(); try { shutdown(); } catch (IOException ignore) { } // Usually #abortConnection() is expected to be called from // a helper thread in order to unblock the main execution thread // blocked in an I/O operation. It may be unsafe to call // #releaseConnection() from the helper thread, so we have to rely // on an IOException thrown by the closed socket on the main thread // to trigger the release of the connection back to the // connection manager. // // However, if this method is called from the main execution thread // it should be safe to release the connection immediately. Besides, // this also helps ensure the connection gets released back to the // manager if #abortConnection() is called from the main execution // thread while there is no blocking I/O operation. if (executionThread.equals(Thread.currentThread())) { releaseConnection(); } }
public synchronized void abortConnection() { if (released) { return; } released = true; unmarkReusable(); try { shutdown(); } catch (final IOException ignore) { } connManager.releaseConnection(this, duration, TimeUnit.MILLISECONDS); }
public boolean isStale() { if (isReleased()) { return true; } final OperatedClientConnection conn = getWrappedConnection(); if (conn == null) { return true; } return conn.isStale(); }
public boolean isStale() { if (aborted) return true; OperatedClientConnection conn = getWrappedConnection(); if (conn == null) return true; return conn.isStale(); }
/** * @deprecated (4.1) use {@link #assertValid(OperatedClientConnection)} */ @Deprecated protected final void assertNotAborted() throws InterruptedIOException { if (isReleased()) { throw new InterruptedIOException("Connection has been shut down"); } }
public void sendRequestHeader(final HttpRequest request) throws HttpException, IOException { final OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); unmarkReusable(); conn.sendRequestHeader(request); }
public boolean isResponseAvailable(int timeout) throws IOException { assertNotAborted(); OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); return conn.isResponseAvailable(timeout); }
public int getLocalPort() { OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); return conn.getLocalPort(); }
public void abortConnection() { if (aborted) { return; } aborted = true; unmarkReusable(); try { shutdown(); } catch (IOException ignore) { } // Usually #abortConnection() is expected to be called from // a helper thread in order to unblock the main execution thread // blocked in an I/O operation. It may be unsafe to call // #releaseConnection() from the helper thread, so we have to rely // on an IOException thrown by the closed socket on the main thread // to trigger the release of the connection back to the // connection manager. // // However, if this method is called from the main execution thread // it should be safe to release the connection immediately. Besides, // this also helps ensure the connection gets released back to the // manager if #abortConnection() is called from the main execution // thread while there is no blocking I/O operation. if (executionThread.equals(Thread.currentThread())) { releaseConnection(); } }
@Override public synchronized void abortConnection() { if (released) { return; } released = true; unmarkReusable(); try { shutdown(); } catch (final IOException ignore) { } connManager.releaseConnection(this, duration, TimeUnit.MILLISECONDS); }
public boolean isStale() { if (isReleased()) { return true; } final OperatedClientConnection conn = getWrappedConnection(); if (conn == null) { return true; } return conn.isStale(); }
public boolean isOpen() { OperatedClientConnection conn = getWrappedConnection(); if (conn == null) return false; return conn.isOpen(); }
/** * @deprecated (4.1) use {@link #assertValid(OperatedClientConnection)} */ @Deprecated protected final void assertNotAborted() throws InterruptedIOException { if (isReleased()) { throw new InterruptedIOException("Connection has been shut down"); } }
public void sendRequestHeader(HttpRequest request) throws HttpException, IOException { assertNotAborted(); OperatedClientConnection conn = getWrappedConnection(); assertValid(conn); unmarkReusable(); conn.sendRequestHeader(request); }