Interface AsyncGet<R,E extends Throwable>
- Type Parameters:
R- The type of the return value.E- The exception type that the underlying implementation may throw.
public interface AsyncGet<R,E extends Throwable>
This interface defines an asynchronous
get(long, TimeUnit) method.
When the return value is still being computed, invoking
get(long, TimeUnit) will result in a TimeoutException.
The method should be invoked again and again
until the underlying computation is completed.-
Nested Class Summary
Nested Classes -
Method Summary
-
Method Details
-
get
Get the result.- Parameters:
timeout- The maximum time period to wait. When timeout == 0, it does not wait at all. When timeout < 0, it waits indefinitely.unit- The unit of the timeout value- Returns:
- the result, which is possibly null.
- Throws:
E- an exception thrown by the underlying implementation.TimeoutException- if it cannot return after the given time period.InterruptedException- if the thread is interrupted.
-
isDone
boolean isDone()- Returns:
- true if the underlying computation is done; false, otherwise.
-