Package org.elasticsearch.action.support
Class PlainListenableActionFuture<T>
java.lang.Object
org.elasticsearch.common.util.concurrent.BaseFuture<T>
org.elasticsearch.action.support.AdapterActionFuture<T,T>
org.elasticsearch.action.support.PlainListenableActionFuture<T>
- All Implemented Interfaces:
java.util.concurrent.Future<T>
,ActionFuture<T>
,ActionListener<T>
,ListenableActionFuture<T>
public class PlainListenableActionFuture<T> extends AdapterActionFuture<T,T> implements ListenableActionFuture<T>
-
Constructor Summary
Constructors Modifier Constructor Description protected
PlainListenableActionFuture()
-
Method Summary
Modifier and Type Method Description void
addListener(ActionListener<T> listener)
Add an action listener to be invoked when a response has received.protected T
convert(T listenerResponse)
protected void
done(boolean success)
Called when theBaseFuture
is completed.static <T> PlainListenableActionFuture<T>
newListenableFuture()
This method returns a listenable future.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
-
Constructor Details
-
PlainListenableActionFuture
protected PlainListenableActionFuture()
-
-
Method Details
-
newListenableFuture
This method returns a listenable future. The listeners will be called on completion of the future. The listeners will be executed by the same thread that completes the future.- Type Parameters:
T
- the result of the future- Returns:
- a listenable future
-
addListener
Description copied from interface:ListenableActionFuture
Add an action listener to be invoked when a response has received.- Specified by:
addListener
in interfaceListenableActionFuture<T>
-
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>
-