org.apache.http.conn.ManagedClientConnection Java Examples

The following examples show how to use org.apache.http.conn.ManagedClientConnection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LibRequestDirector.java    From YiBo with Apache License 2.0 6 votes vote down vote up
/**
 * Shuts down the connection.
 * This method is called from a <code>catch</code> block in
 * {@link #execute execute} during exception handling.
 */
private void abortConnection() {
    ManagedClientConnection mcc = managedConn;
    if (mcc != null) {
        // we got here as the result of an exception
        // no response will be returned, release the connection
        managedConn = null;
        try {
            mcc.abortConnection();
        } catch (IOException ex) {
        	if (DEBUG) {
        		Logger.debug(ex.getMessage(), ex);
            }
        }
        // ensure the connection manager properly releases this connection
        try {
            mcc.releaseConnection();
        } catch (IOException ignored) {
        	if (DEBUG) {
        		Logger.debug("Error releasing connection", ignored);
        	}
        }
    }
}