Package com.yahoo.search.searchchain
Class FutureResult
- java.lang.Object
-
- java.util.concurrent.FutureTask<Result>
-
- com.yahoo.search.searchchain.FutureResult
-
-
Constructor Summary
Constructors Constructor Description FutureResult(java.util.concurrent.Callable<Result> callable, Execution execution, Query query)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ErrorMessage
createTimeoutError()
Result
get()
Returns a Result containing the hits returned from this source, or an error otherwise.Result
get(long timeout, java.util.concurrent.TimeUnit timeunit)
Returns a Result containing the hits returned from this source, or an error otherwise.java.util.Optional<Result>
getIfAvailable(long timeout, java.util.concurrent.TimeUnit timeunit)
Same as get(timeout, timeunit) but returns Optional.empty instead of a result with error if the result is not available in timeQuery
getQuery()
Returns the query used in this execution, never null
-
-
-
Method Detail
-
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.
-
get
public Result get(long timeout, java.util.concurrent.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.
-
getIfAvailable
public java.util.Optional<Result> getIfAvailable(long timeout, java.util.concurrent.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
-
createTimeoutError
public ErrorMessage createTimeoutError()
-
-