Package org.elasticsearch.action
Class SingleResultDeduplicator<T>
java.lang.Object
org.elasticsearch.action.SingleResultDeduplicator<T>
- Type Parameters:
T
- Result type
Wraps an async action that consumes an
ActionListener
such that multiple invocations of execute(ActionListener)
can
share the result from a single call to the wrapped action. This implementation is similar to ResultDeduplicator
but offers
stronger guarantees of not seeing a stale result ever. Concretely, every invocation of execute(ActionListener)
is guaranteed to
be resolved with a response that has been computed at a time after the call to execute
has been made. This allows this class to
be used to deduplicate results from actions that produce results that change over time transparently.-
Constructor Summary
ConstructorDescriptionSingleResultDeduplicator
(ThreadContext threadContext, Consumer<ActionListener<T>> executeAction) -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(ActionListener<T> listener) Execute the action for the givenlistener
.
-
Constructor Details
-
SingleResultDeduplicator
public SingleResultDeduplicator(ThreadContext threadContext, Consumer<ActionListener<T>> executeAction)
-
-
Method Details
-
execute
Execute the action for the givenlistener
.- Parameters:
listener
- listener to resolve with execution result
-