T
- The return type of the Future.public class AsyncTask<T>
extends java.lang.Object
Future
that can be retrieved using getUnderlyingFuture()
Constructor and Description |
---|
AsyncTask(java.util.concurrent.Future<T> f)
Creates a new instance of the class from an existing
Future |
Modifier and Type | Method and Description |
---|---|
T |
await()
Waits for the operation to complete and returns the result.
|
T |
await(long timeout,
java.util.concurrent.TimeUnit unit)
Waits for the operation to complete within the specified delay and returns the result.
|
java.util.concurrent.Future<T> |
getUnderlyingFuture() |
public AsyncTask(java.util.concurrent.Future<T> f)
Future
public T await() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
java.lang.InterruptedException
- if the task was cancelledjava.util.concurrent.ExecutionException
- if the computation threw an exceptionpublic T await(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
java.lang.InterruptedException
- if the task was cancelledjava.util.concurrent.ExecutionException
- if the computation threw an exceptionjava.util.concurrent.TimeoutException
- if the task timed outpublic java.util.concurrent.Future<T> getUnderlyingFuture()