com.sun.jersey.client.impl.async
Class FutureClientResponseListener<T>

java.lang.Object
  extended by java.util.concurrent.FutureTask<T>
      extended by com.sun.jersey.client.impl.async.FutureClientResponseListener<T>
All Implemented Interfaces:
FutureListener<ClientResponse>, Runnable, Future<T>, RunnableFuture<T>

public abstract class FutureClientResponseListener<T>
extends FutureTask<T>
implements FutureListener<ClientResponse>

Author:
Paul.Sandoz@Sun.Com

Constructor Summary
FutureClientResponseListener()
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
protected abstract  T get(ClientResponse response)
           
 boolean isCancelled()
           
 void onComplete(Future<ClientResponse> response)
          Invoked when a Future has reached the completed termination state.
 void setCancelableFuture(Future<ClientResponse> f)
           
 
Methods inherited from class java.util.concurrent.FutureTask
done, get, get, isDone, run, runAndReset, set, setException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FutureClientResponseListener

public FutureClientResponseListener()
Method Detail

setCancelableFuture

public void setCancelableFuture(Future<ClientResponse> f)

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface Future<T>
Overrides:
cancel in class FutureTask<T>

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<T>
Overrides:
isCancelled in class FutureTask<T>

onComplete

public void onComplete(Future<ClientResponse> response)
Description copied from interface: FutureListener
Invoked when a Future has reached the completed termination state.

The catching of a ExecutionException when Future.get is invoked may be utilized to determine if the future terminated with an exception. The exception can be obtained by invoking Throwable.getCause().

The catching of a CancellationException when Future.get is invoked may be utilized to determine if the future terminated with a cancellation.

Specified by:
onComplete in interface FutureListener<ClientResponse>
Parameters:
response - the completed Future. Invocation of Future.isDone() will return true. Since the future is complete invocation of Future.get() and Future.get(long, java.util.concurrent.TimeUnit) will not result in the throwing of an InterruptedException.

get

protected abstract T get(ClientResponse response)


Copyright © 2011 Oracle Corporation. All Rights Reserved.