Example usage for org.apache.http.nio.concurrent BasicFuture isDone

List of usage examples for org.apache.http.nio.concurrent BasicFuture isDone

Introduction

In this page you can find the example usage for org.apache.http.nio.concurrent BasicFuture isDone.

Prototype

public boolean isDone() 

Source Link

Usage

From source file:org.apache.http.impl.nio.conn.PoolingClientConnectionManager.java

public Future<ManagedClientConnection> leaseConnection(final HttpRoute route, final Object state,
        final long timeout, final TimeUnit tunit, final FutureCallback<ManagedClientConnection> callback) {
    if (route == null) {
        throw new IllegalArgumentException("HTTP route may not be null");
    }// w w w. ja va  2  s  .c o m
    if (tunit == null) {
        throw new IllegalArgumentException("Time unit may not be null");
    }
    if (this.log.isDebugEnabled()) {
        this.log.debug("Connection request: route[" + route + "][state: " + state + "]");
        PoolStats totals = this.pool.getTotalStats();
        PoolStats stats = this.pool.getStats(route);
        this.log.debug("Total: " + totals);
        this.log.debug("Route [" + route + "]: " + stats);
    }
    BasicFuture<ManagedClientConnection> future = new BasicFuture<ManagedClientConnection>(callback);
    this.pool.lease(route, state, timeout, tunit, new InternalPoolEntryCallback(future));
    if (this.log.isDebugEnabled()) {
        if (!future.isDone()) {
            this.log.debug("Connection could not be allocated immediately: " + "route[" + route + "][state: "
                    + state + "]");
        }
    }
    return future;
}