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

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

Introduction

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

Prototype

public int getAsynchronousWorkersMax() 

Source Link

Document

Returns the maximum number of threads to allow 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 a  va  2 s. 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  w  w  . j  av a2s  .c om*/
public AsynchronousValidator(CachingHttpClient cachingClient, 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.CachingHttpAsyncClient.java

private AsynchronousAsyncValidator makeAsynchronousValidator(final CacheConfig config) {
    if (config.getAsynchronousWorkersMax() > 0) {
        return new AsynchronousAsyncValidator(this, config);
    }//ww  w .  ja  va2  s . c  o m
    return null;
}

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

private AsynchronousValidator makeAsynchronousValidator(CacheConfig config) {
    if (config.getAsynchronousWorkersMax() > 0) {
        return new AsynchronousValidator(this, config);
    }//from   ww w .j  a va2 s  .com
    return null;
}