Class 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.
      listener - listener to resolve with execution result