Class SingleResultDeduplicator<T>

java.lang.Object
org.elasticsearch.action.SingleResultDeduplicator<T>
Type Parameters:
T - Result type

public final class SingleResultDeduplicator<T> extends Object
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 Details

  • Method Details

    • execute

      public void execute(ActionListener<T> listener)
      Execute the action for the given listener.
      Parameters:
      listener - listener to resolve with execution result. The listener always has its threadContext preserved, i.e. when the listener is invoked, it will see its original threadContext plus any response headers generated by performing the executeAction.