Example usage for org.apache.http.pool PoolEntry getRoute

List of usage examples for org.apache.http.pool PoolEntry getRoute

Introduction

In this page you can find the example usage for org.apache.http.pool PoolEntry getRoute.

Prototype

public T getRoute() 

Source Link

Usage

From source file:com.couchbase.client.http.ViewPool.java

/**
 * Closes the underlying connections for the given {@link HttpHost}.
 *
 * Since on a rebalance out, all connections to this view node need to
 * be closed, regardless if they are currently available or leased.
 *
 * @param host the host to shutdown connections for.
 *//*from  ww w.jav  a 2  s .c  o  m*/
public void closeConnectionsForHost(final HttpHost host) {
    // In-flight operations will be cancelled and retried in other parts of
    // the codebase.
    enumAvailable(new PoolEntryCallback<HttpHost, NHttpClientConnection>() {
        @Override
        public void process(PoolEntry<HttpHost, NHttpClientConnection> entry) {
            if (entry.getRoute().equals(host)) {
                entry.updateExpiry(0, TimeUnit.MILLISECONDS);
            }
        }
    });

    enumLeased(new PoolEntryCallback<HttpHost, NHttpClientConnection>() {
        @Override
        public void process(PoolEntry<HttpHost, NHttpClientConnection> entry) {
            if (entry.getRoute().equals(host)) {
                entry.updateExpiry(0, TimeUnit.MILLISECONDS);
            }
        }
    });

    closeExpired();
}