Example usage for org.apache.http.concurrent BasicFuture get

List of usage examples for org.apache.http.concurrent BasicFuture get

Introduction

In this page you can find the example usage for org.apache.http.concurrent BasicFuture get.

Prototype

public synchronized T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException 

Source Link

Usage

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

@Override
public void run() {
    try {//from   w  w  w .  j a  va2  s .c o  m
        final FutureCallback<HttpResponse> callback = new FutureCallback<HttpResponse>() {

            @Override
            public void cancelled() {
            }

            @Override
            public void completed(final HttpResponse httpResponse) {
            }

            @Override
            public void failed(final Exception e) {
                log.debug("Asynchronous revalidation failed", e);
            }
        };
        final BasicFuture<HttpResponse> future = new BasicFuture<HttpResponse>(callback);
        this.cachingAsyncClient.revalidateCacheEntry(future, this.target, this.request, this.clientContext,
                this.cacheEntry);
        future.get();
    } catch (final ProtocolException pe) {
        this.log.error("ProtocolException thrown during asynchronous revalidation", pe);
    } catch (final ExecutionException e) {
        this.log.error("Exception thrown during asynchronous revalidation", e.getCause());
    } catch (final InterruptedException e) {
        Thread.currentThread().interrupt();
    } finally {
        this.parent.markComplete(this.identifier);
    }
}