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

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

Introduction

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

Prototype

AsynchronousAsyncValidationRequest(final AsynchronousAsyncValidator parent,
        final CachingHttpAsyncClient cachingClient, final HttpHost target, final HttpRequestWrapper request,
        final HttpCacheContext clientContext, final HttpCacheEntry cacheEntry, final String identifier) 

Source Link

Document

Used internally by AsynchronousValidator to schedule a revalidation.

Usage

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

/**
 * Schedules an asynchronous revalidation
 *//* ww  w  .  j  ava 2s  . c  o m*/
public synchronized void revalidateCacheEntry(final HttpHost target, final HttpRequestWrapper request,
        final HttpCacheContext clientContext, final HttpCacheEntry entry) {
    // getVariantURI will fall back on getURI if no variants exist
    final String uri = this.cacheKeyGenerator.getVariantURI(target, request, entry);

    if (!this.queued.contains(uri)) {
        final AsynchronousAsyncValidationRequest asyncRevalidationRequest = new AsynchronousAsyncValidationRequest(
                this, this.cachingAsyncClient, target, request, clientContext, entry, uri);

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