RunnableFuture
interface RunnableFuture<V : Any!> : Runnable, Future<V>
A Future that is Runnable. Successful execution of the run method causes completion of the Future and allows access to its results.
Summary
| Public methods |
| abstract Unit |
Sets this Future to the result of its computation unless it has been cancelled.
|
| Inherited functions |
From class Future
Boolean |
cancel(mayInterruptIfRunning: Boolean)
Attempts to cancel execution of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel is called, this task should never run. If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task.
After this method returns, subsequent calls to isDone will always return true. Subsequent calls to isCancelled will always return true if this method returned true.
|
V |
get()
Waits if necessary for the computation to complete, and then retrieves its result.
|
V |
get(timeout: Long, unit: TimeUnit!)
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
|
Boolean |
isCancelled()
Returns true if this task was cancelled before it completed normally.
|
Boolean |
isDone()
Returns true if this task completed. Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return true.
|
|
Public methods
run
abstract fun run(): Unit
Sets this Future to the result of its computation unless it has been cancelled.