public class FutureResult extends FutureTask<Result>
FutureTask<Result>
, with some added error handlingModifier and Type | Field and Description |
---|---|
private Execution |
execution
Only used for generating messages
|
private static Logger |
log |
private Query |
query |
Constructor and Description |
---|
FutureResult(Callable<Result> callable,
Execution execution,
Query query) |
Modifier and Type | Method and Description |
---|---|
private ErrorMessage |
createExecutionError(Exception e) |
private ErrorMessage |
createInterruptedError(Exception e) |
ErrorMessage |
createTimeoutError() |
Result |
get()
Returns a Result containing the hits returned from this source, or an error otherwise.
|
Result |
get(long timeout,
TimeUnit timeunit)
Returns a Result containing the hits returned from this source, or an error otherwise.
|
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
|
Query |
getQuery()
Returns the query used in this execution, never null
|
cancel, done, isCancelled, isDone, run, runAndReset, set, setException
private final Query query
private final Execution execution
private static final Logger log
public Result get()
public Result get(long timeout, TimeUnit timeunit)
public Optional<Result> getIfAvailable(long timeout, TimeUnit timeunit)
public Query getQuery()
private ErrorMessage createInterruptedError(Exception e)
private ErrorMessage createExecutionError(Exception e)
public ErrorMessage createTimeoutError()
Copyright © 2018. All rights reserved.