Example usage for org.apache.http.impl.conn.tsccm RouteSpecificPool deleteEntry

List of usage examples for org.apache.http.impl.conn.tsccm RouteSpecificPool deleteEntry

Introduction

In this page you can find the example usage for org.apache.http.impl.conn.tsccm RouteSpecificPool deleteEntry.

Prototype

public boolean deleteEntry(final BasicPoolEntry entry) 

Source Link

Document

Deletes an entry from this pool.

Usage

From source file:org.apache.http.impl.conn.tsccm.ConnPoolByRoute.java

/**
 * Deletes a given pool entry.//from   w  w  w.  java  2 s . c  om
 * This closes the pooled connection and removes all references,
 * so that it can be GCed.
 *
 * <p><b>Note:</b> Does not remove the entry from the freeConnections list.
 * It is assumed that the caller has already handled this step.</p>
 * <!-- @@@ is that a good idea? or rather fix it? -->
 *
 * @param entry         the pool entry for the connection to delete
 */
protected void deleteEntry(final BasicPoolEntry entry) {

    final HttpRoute route = entry.getPlannedRoute();

    if (log.isDebugEnabled()) {
        log.debug("Deleting connection" + " [" + route + "][" + entry.getState() + "]");
    }

    poolLock.lock();
    try {

        closeConnection(entry);

        final RouteSpecificPool rospl = getRoutePool(route, true);
        rospl.deleteEntry(entry);
        numConnections--;
        if (rospl.isUnused()) {
            routeToPool.remove(route);
        }

    } finally {
        poolLock.unlock();
    }
}