Package org.elasticsearch.action.support
Class ListenableActionFuture<T>
java.lang.Object
org.elasticsearch.common.util.concurrent.BaseFuture<T>
org.elasticsearch.action.support.AdapterActionFuture<T,T>
org.elasticsearch.action.support.ListenableActionFuture<T>
- All Implemented Interfaces:
Future<T>
,ActionFuture<T>
,ActionListener<T>
A
Future
and ActionListener
against which which other ActionListener
s can be registered later, to support
fanning-out a result to a dynamic collection of listeners.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.action.ActionListener
ActionListener.Delegating<Response,DelegateResponse>, ActionListener.DelegatingActionListener<T>, ActionListener.DelegatingFailureActionListener<T,R>, ActionListener.MappedActionListener<Response,MappedResponse>, ActionListener.RunAfterActionListener<T>, ActionListener.RunBeforeActionListener<T>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener(ActionListener<T> listener)
Registers anActionListener
to be notified when this future is completed.protected T
protected void
done(boolean success)
Called when theBaseFuture
is completed.Methods inherited from class org.elasticsearch.action.support.AdapterActionFuture
actionGet, actionGet, actionGet, actionGet, actionGet, onFailure, onResponse
Methods inherited from class org.elasticsearch.common.util.concurrent.BaseFuture
blockingAllowed, cancel, get, get, interruptTask, isCancelled, isDone, set, setException
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.action.ActionListener
delegateFailure, delegateResponse, map
-
Constructor Details
-
ListenableActionFuture
public ListenableActionFuture()
-
-
Method Details
-
addListener
Registers anActionListener
to be notified when this future is completed. If the future is already completed then the listener is notified immediately, on the calling thread. If not, the listener is notified on the thread that completes the listener. -
done
protected void done(boolean success)Description copied from class:BaseFuture
Called when theBaseFuture
is completed. Thesuccess
boolean indicates if theBaseFuture
was successfully completed (the value istrue
). In the cases theBaseFuture
was completed with an error or cancelled the value isfalse
.- Overrides:
done
in classBaseFuture<T>
- Parameters:
success
- indicates if theBaseFuture
was completed with success (true); in other cases it equals to false
-
convert
- Specified by:
convert
in classAdapterActionFuture<T,T>
-