Example usage for org.apache.http.impl.client.cache CacheConfig getAsynchronousWorkerIdleLifetimeSecs

List of usage examples for org.apache.http.impl.client.cache CacheConfig getAsynchronousWorkerIdleLifetimeSecs

Introduction

In this page you can find the example usage for org.apache.http.impl.client.cache CacheConfig getAsynchronousWorkerIdleLifetimeSecs.

Prototype

public int getAsynchronousWorkerIdleLifetimeSecs() 

Source Link

Document

Returns the current maximum idle lifetime in seconds for a background revalidation worker thread.

Usage

From source file:org.apache.http.impl.client.cache.AsynchronousAsyncValidator.java

/**
 * Create AsynchronousValidator which will make revalidation requests using
 * the supplied {@link CachingHttpAsyncClient}, and a {@link ThreadPoolExecutor}
 * generated according to the thread pool settings provided in the given
 * {@link CacheConfig}.//from   w  w w .  j av  a  2s  .c o  m
 *
 * @param cachingClient
 *            used to execute asynchronous requests
 * @param config
 *            specifies thread pool settings. See
 *            {@link CacheConfig#getAsynchronousWorkersMax()},
 *            {@link CacheConfig#getAsynchronousWorkersCore()},
 *            {@link CacheConfig#getAsynchronousWorkerIdleLifetimeSecs()},
 *            and {@link CacheConfig#getRevalidationQueueSize()}.
 */
public AsynchronousAsyncValidator(final CachingHttpAsyncClient cachingClient, final CacheConfig config) {
    this(cachingClient,
            new ThreadPoolExecutor(config.getAsynchronousWorkersCore(), config.getAsynchronousWorkersMax(),
                    config.getAsynchronousWorkerIdleLifetimeSecs(), TimeUnit.SECONDS,
                    new ArrayBlockingQueue<Runnable>(config.getRevalidationQueueSize())));
}

From source file:org.apache.http.impl.client.cache.AsynchronousValidator.java

/**
 * Create AsynchronousValidator which will make revalidation requests
 * using the supplied {@link CachingHttpClient}, and 
 * a {@link ThreadPoolExecutor} generated according to the thread
 * pool settings provided in the given {@link CacheConfig}. 
 * @param cachingClient used to execute asynchronous requests
 * @param config specifies thread pool settings. See
 * {@link CacheConfig#getAsynchronousWorkersMax()},
 * {@link CacheConfig#getAsynchronousWorkersCore()},
 * {@link CacheConfig#getAsynchronousWorkerIdleLifetimeSecs()},
 * and {@link CacheConfig#getRevalidationQueueSize()}. 
 *//*from w  ww.j av  a2  s .c o  m*/
public AsynchronousValidator(CachingHttpClient cachingClient, CacheConfig config) {
    this(cachingClient,
            new ThreadPoolExecutor(config.getAsynchronousWorkersCore(), config.getAsynchronousWorkersMax(),
                    config.getAsynchronousWorkerIdleLifetimeSecs(), TimeUnit.SECONDS,
                    new ArrayBlockingQueue<Runnable>(config.getRevalidationQueueSize())));
}