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
All Methods Static Methods Instance Methods Concrete Methods 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()
static <T> PlainListenableActionFuture<T>
newDispatchingListenableFuture(ThreadPool threadPool)
This method returns a listenable future.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
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
-
-
-
-
Method Detail
-
newListenableFuture
public static <T> PlainListenableActionFuture<T> 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
-
newDispatchingListenableFuture
public static <T> PlainListenableActionFuture<T> newDispatchingListenableFuture(ThreadPool threadPool)
This method returns a listenable future. The listeners will be called on completion of the future. The listeners will be executed on the LISTENER thread pool.- Type Parameters:
T
- the result of the future- Parameters:
threadPool
- the thread pool used to execute listeners- Returns:
- a listenable future
-
addListener
public void addListener(ActionListener<T> listener)
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()
- Overrides:
done
in classBaseFuture<T>
-
-