Example usage for org.apache.http.impl.nio.conn PoolingNHttpClientConnectionManager getTotalStats

List of usage examples for org.apache.http.impl.nio.conn PoolingNHttpClientConnectionManager getTotalStats

Introduction

In this page you can find the example usage for org.apache.http.impl.nio.conn PoolingNHttpClientConnectionManager getTotalStats.

Prototype

@Override
    public PoolStats getTotalStats() 

Source Link

Usage

From source file:org.grycap.gpf4med.DownloadService.java

/**
 * Initiates shutdown of the download manager and blocks approximately for the 
 * given period of time in milliseconds waiting for the download manager to 
 * terminate all active connections, to shut down itself and to release system 
 * resources it currently holds.//from   w ww .  ja  va  2 s  .  co  m
 * @param connectionManager connection session pool.
 * @param waitMs wait time in milliseconds.
 */
private void shutdown(final PoolingNHttpClientConnectionManager connectionManager, final long waitMs) {
    PoolStats poolStats = null;
    try {
        if (connectionManager != null) {
            try {
                poolStats = connectionManager.getTotalStats();
            } catch (Exception ignore) {
                LOGGER.warn("Failed to collect connection manager stats", ignore);
            }
            connectionManager.shutdown(waitMs);
        }
    } catch (Exception e) {
        LOGGER.warn("Failed to shut down connection manager", e);
    } finally {
        LOGGER.info("Connection manager was shutted down [pool_stats_before_shutdown="
                + (poolStats != null ? poolStats.toString() : "NOT_AVAILABLE") + "]");
    }
}