Class FutureResult

java.lang.Object
java.util.concurrent.FutureTask<Result>
com.yahoo.search.searchchain.FutureResult
All Implemented Interfaces:
Runnable, Future<Result>, RunnableFuture<Result>

public class FutureResult extends FutureTask<Result>
Extends a FutureTask&lt;Result&gt;, with some added error handling
Author:
bratseth
  • Constructor Details

  • Method Details

    • get

      public Result get()
      Returns a Result containing the hits returned from this source, or an error otherwise. This will block for however long it takes to get the result: Using this is a bad idea.
      Specified by:
      get in interface Future<Result>
      Overrides:
      get in class FutureTask<Result>
    • get

      public Result get(long timeout, TimeUnit timeunit)
      Returns a Result containing the hits returned from this source, or an error otherwise. This blocks for at most the given timeout and returns a Result containing a timeout error if the result is not available within this time.
      Specified by:
      get in interface Future<Result>
      Overrides:
      get in class FutureTask<Result>
    • getIfAvailable

      public Optional<Result> getIfAvailable(long timeout, TimeUnit timeunit)
      Same as get(timeout, timeunit) but returns Optional.empty instead of a result with error if the result is not available in time
    • getQuery

      public Query getQuery()
      Returns the query used in this execution, never null
    • getExecution

      public Execution getExecution()
      Returns the execution which creates this
    • createTimeoutError

      public ErrorMessage createTimeoutError()