java.lang.Object |
↳ |
com.ning.http.client.listenable.AbstractListenableFuture<V> |
Known Direct Subclasses
|
Known Indirect Subclasses
|
Class Overview
An abstract base implementation of the listener support provided by
ListenableFuture
. This class uses an ExecutionList
to
guarantee that all registered listeners will be executed. Listener/Executor
pairs are stored in the execution list and executed in the order in which
they were added, but because of thread scheduling issues there is no
guarantee that the JVM will execute them in order. In addition, listeners
added after the task is complete will be executed immediately, even if some
previously added listeners have not yet been executed.
Summary
Protected Methods |
void
|
done()
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0)
|
final
void
|
wait(long arg0, int arg1)
|
|
From interface
com.ning.http.client.ListenableFuture
abstract
void
|
abort(Throwable t)
Abort the current processing, and propagate the Throwable to the AsyncHandler or Future
|
abstract
ListenableFuture<V>
|
addListener(Runnable listener, Executor exec)
Adds a listener and executor to the ListenableFuture.
|
abstract
void
|
content(V v)
Set the content that will be returned by this instance
|
abstract
void
|
done(Callable callable)
Execute a Callable and if there is no exception, mark this Future as done and release the internal lock.
|
abstract
boolean
|
getAndSetWriteBody(boolean writeBody)
|
abstract
boolean
|
getAndSetWriteHeaders(boolean writeHeader)
|
abstract
void
|
touch()
Touch the current instance to prevent external service to times out.
|
|
From interface
java.util.concurrent.Future
abstract
boolean
|
cancel(boolean arg0)
|
abstract
V
|
get()
|
abstract
V
|
get(long arg0, TimeUnit arg1)
|
abstract
boolean
|
isCancelled()
|
abstract
boolean
|
isDone()
|
|
Public Constructors
public
AbstractListenableFuture
()
Public Methods
public
ListenableFuture<V>
addListener
(Runnable listener, Executor exec)
Adds a listener and executor to the ListenableFuture.
The listener will be passed
to the executor
for execution when the Future
's computation is
complete
.
There is no guaranteed ordering of execution of listeners, they may get
called in the order they were added and they may get called out of order,
but any listener added through this method is guaranteed to be called once
the computation is complete.
Parameters
listener
| the listener to run when the computation is complete. |
exec
| the executor to run the listener in. |
Protected Methods