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

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

Introduction

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

Prototype

public int getAsynchronousWorkersCore() 

Source Link

Document

Returns the minimum number of threads to keep alive for background revalidations due to the stale-while-revalidate directive.

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}./*  w w  w  . j  av  a 2  s  . c om*/
 *
 * @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()}. 
 *//*w  w w . j a va2  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())));
}