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

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

Introduction

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

Prototype

public boolean isUnused() 

Source Link

Document

Indicates whether this pool is unused.

Usage

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

/**
 * Deletes a given pool entry./* w w w. j av a 2  s  .  c  o  m*/
 * 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();
    }
}

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

@Override
protected void handleLostEntry(final HttpRoute route) {

    poolLock.lock();// w ww .j a va  2  s  . c  o  m
    try {

        final RouteSpecificPool rospl = getRoutePool(route, true);
        rospl.dropEntry();
        if (rospl.isUnused()) {
            routeToPool.remove(route);
        }

        numConnections--;
        notifyWaitingThread(rospl);

    } finally {
        poolLock.unlock();
    }
}