Example usage for org.apache.http.impl.client.cache AsynchronousValidationRequest AsynchronousValidationRequest

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

Introduction

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

Prototype

AsynchronousValidationRequest(AsynchronousValidator parent, CachingHttpClient cachingClient, HttpHost target,
        HttpRequest request, HttpContext context, HttpCacheEntry cacheEntry, String identifier) 

Source Link

Document

Used internally by AsynchronousValidator to schedule a revalidation.

Usage

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

/**
 * Schedules an asynchronous revalidation
 * //ww w.  ja  va 2  s  .  c  o  m
 * @param target
 * @param request
 * @param context
 * @param entry
 */
public synchronized void revalidateCacheEntry(HttpHost target, HttpRequest request, HttpContext context,
        HttpCacheEntry entry) {
    // getVariantURI will fall back on getURI if no variants exist
    String uri = cacheKeyGenerator.getVariantURI(target, request, entry);

    if (!queued.contains(uri)) {
        AsynchronousValidationRequest revalidationRequest = new AsynchronousValidationRequest(this,
                cachingClient, target, request, context, entry, uri);

        try {
            executor.execute(revalidationRequest);
            queued.add(uri);
        } catch (RejectedExecutionException ree) {
            log.debug("Revalidation for [" + uri + "] not scheduled: " + ree);
        }
    }
}