Example usage for org.apache.http.nio.conn ManagedClientAsyncConnection isOpen

List of usage examples for org.apache.http.nio.conn ManagedClientAsyncConnection isOpen

Introduction

In this page you can find the example usage for org.apache.http.nio.conn ManagedClientAsyncConnection isOpen.

Prototype

boolean isOpen();

Source Link

Usage

From source file:org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.java

private synchronized void connectionRequestCompleted(final ManagedClientAsyncConnection conn) {
    if (this.log.isDebugEnabled()) {
        this.log.debug("[exchange: " + this.id + "] Connection allocated: " + conn);
    }// w  w  w.  j a  v  a 2 s.co  m
    this.connRequestCallback = null;
    try {
        this.managedConn = conn;
        if (this.closed) {
            conn.releaseConnection();
            return;
        }
        final HttpRoute route = this.mainRequest.getRoute();
        if (!conn.isOpen()) {
            conn.open(route, this.localContext, this.params);
        }
        conn.getContext().setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this);
        conn.requestOutput();
        this.routeEstablished = route.equals(conn.getRoute());
        if (!conn.isOpen()) {
            throw new ConnectionClosedException("Connection closed");
        }
    } catch (final IOException ex) {
        failed(ex);
    } catch (final RuntimeException runex) {
        failed(runex);
        throw runex;
    }
}