com.sun.jersey.api.client.async
Interface FutureListener<T>

Type Parameters:
T - the type held by the future.
All Known Subinterfaces:
ITypeListener<T>
All Known Implementing Classes:
TypeListener

public interface FutureListener<T>

A future listener to receive an event when a Future has reached the completed termination state of normal termination, an exception or cancellation.

Author:
[email protected]

Method Summary
 void onComplete(java.util.concurrent.Future<T> f)
          Invoked when a Future has reached the completed termination state.
 

Method Detail

onComplete

void onComplete(java.util.concurrent.Future<T> f)
                throws java.lang.InterruptedException
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.

Parameters:
f - 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.
Throws:
java.lang.InterruptedException - this exception is declared so that the developer does not need to catch it when invoking Future.get.


Copyright © 2011 Oracle Corporation. All Rights Reserved.