V
- Type of the value that will be returned.public interface ListenableFuture<V> extends Future<V>
Future
Modifier and Type | Method and Description |
---|---|
void |
abort(Throwable t)
|
ListenableFuture<V> |
addListener(Runnable listener,
Executor exec)
Adds a listener and executor to the ListenableFuture.
|
void |
content(V v)
Set the content that will be returned by this instance
|
void |
done()
Terminate and if there is no exception, mark this Future as done and release the internal lock.
|
boolean |
getAndSetWriteBody(boolean writeBody)
Write the
Request body |
boolean |
getAndSetWriteHeaders(boolean writeHeader)
Write the
Request headers |
void |
touch()
Touch the current instance to prevent external service to times out.
|
void done()
callable
- void abort(Throwable t)
t
- void content(V v)
v
- the content that will be returned by this instancevoid touch()
boolean getAndSetWriteHeaders(boolean writeHeader)
Request
headersboolean getAndSetWriteBody(boolean writeBody)
Request
bodyListenableFuture<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.
listener
- the listener to run when the computation is complete.exec
- the executor to run the listener in.NullPointerException
- if the executor or listener was null.RejectedExecutionException
- if we tried to execute the listener
immediately but the executor rejected it.Copyright © 2014. All Rights Reserved.