A cancellable asynchronous computation. This class provides a base implementation of Future, with methods to start and cancel a computation, query to see if the computation is complete, and retrieve the result of the computation. The result can only be retrieved when the computation has completed; the get methods will block if the computation has not yet completed. Once the computation has completed, the computation cannot be restarted or cancelled (unless the computation is invoked using runAndReset()).
A FutureTask can be used to wrap a Callable or Runnable object. Because FutureTask implements Runnable, a FutureTask can be submitted to an Executor for execution.
In addition to serving as a standalone class, this class provides protected functionality that may be useful when creating customized task classes.
A cancellable asynchronous computation. This class provides a base implementation of Future, with methods to start and cancel a computation, query to see if the computation is complete, and retrieve the result of the computation. The result can only be retrieved when the computation has completed; the get methods will block if the computation has not yet completed. Once the computation has completed, the computation cannot be restarted or cancelled (unless the computation is invoked using runAndReset()). A FutureTask can be used to wrap a Callable or Runnable object. Because FutureTask implements Runnable, a FutureTask can be submitted to an Executor for execution. In addition to serving as a standalone class, this class provides protected functionality that may be useful when creating customized task classes.
(->future-task callable)
(->future-task runnable result)
Constructor.
Creates a FutureTask that will, upon running, execute the given Runnable, and arrange that get will return the given result on successful completion.
runnable - the runnable task - java.lang.Runnable
result - the result to return on successful completion. If you don't need a particular result, consider using constructions of the form: Future<?> f = new FutureTask<Void>(runnable, null) - V
throws: java.lang.NullPointerException - if the runnable is null
Constructor. Creates a FutureTask that will, upon running, execute the given Runnable, and arrange that get will return the given result on successful completion. runnable - the runnable task - `java.lang.Runnable` result - the result to return on successful completion. If you don't need a particular result, consider using constructions of the form: Future<?> f = new FutureTask<Void>(runnable, null) - `V` throws: java.lang.NullPointerException - if the runnable is null
(cancel this may-interrupt-if-running)
Description copied from interface: Future
may-interrupt-if-running - true if the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete - boolean
returns: false if the task could not be cancelled,
typically because it has already completed normally;
true otherwise - boolean
Description copied from interface: Future may-interrupt-if-running - true if the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete - `boolean` returns: false if the task could not be cancelled, typically because it has already completed normally; true otherwise - `boolean`
(cancelled? this)
Description copied from interface: Future
returns: true if this task was cancelled before it completed - boolean
Description copied from interface: Future returns: true if this task was cancelled before it completed - `boolean`
(done? this)
Description copied from interface: Future
returns: true if this task completed - boolean
Description copied from interface: Future returns: true if this task completed - `boolean`
(get this)
(get this timeout unit)
Description copied from interface: Future
timeout - the maximum time to wait - long
unit - the time unit of the timeout argument - java.util.concurrent.TimeUnit
returns: the computed result - V
throws: java.util.concurrent.CancellationException - if the computation was cancelled
Description copied from interface: Future timeout - the maximum time to wait - `long` unit - the time unit of the timeout argument - `java.util.concurrent.TimeUnit` returns: the computed result - `V` throws: java.util.concurrent.CancellationException - if the computation was cancelled
(run this)
Description copied from interface: RunnableFuture
Description copied from interface: RunnableFuture
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close