com.sun.jersey.client.impl.async
Class FutureClientResponseListener<T>
java.lang.Object
java.util.concurrent.FutureTask<T>
com.sun.jersey.client.impl.async.FutureClientResponseListener<T>
- All Implemented Interfaces:
- FutureListener<ClientResponse>, java.lang.Runnable, java.util.concurrent.Future<T>, java.util.concurrent.RunnableFuture<T>
public abstract class FutureClientResponseListener<T>
- extends java.util.concurrent.FutureTask<T>
- implements FutureListener<ClientResponse>
- Author:
- Paul.Sandoz@Sun.Com
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 |
FutureClientResponseListener
public FutureClientResponseListener()
setCancelableFuture
public void setCancelableFuture(java.util.concurrent.Future<ClientResponse> f)
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interface java.util.concurrent.Future<T>
- Overrides:
cancel
in class java.util.concurrent.FutureTask<T>
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface java.util.concurrent.Future<T>
- Overrides:
isCancelled
in class java.util.concurrent.FutureTask<T>
onComplete
public void onComplete(java.util.concurrent.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 Sun Microsystems, Inc. All Rights Reserved.