Returns a task that performs all evaluation asynchronously.
'Catches' exceptions in the given task and returns them as values.
Ensures the result of this Task satisfies the given predicate, or fails with the given value.
Calls attempt
and handles some exceptions using the given partial
function, calling Task.now on the result.
Calls attempt
and handles some exceptions using the given partial
function, calling Task.now on the result. Any nonmatching exceptions
are reraised.
Calls attempt
and handles some exceptions using the given partial
function.
Calls attempt
and handles some exceptions using the given partial
function. Any nonmatching exceptions are reraised.
Returns a new Task
in which f
is scheduled to be run on completion.
Returns a new Task
in which f
is scheduled to be run on completion.
This would typically be used to release any resources acquired by this
Task
.
Runs this Task
, and if it fails with an exception, runs t2
.
Runs this Task
, and if it fails with an exception, runs t2
.
This is rather coarse-grained. Use attempt
, handle
, and
flatMap
for more fine grained control of exception handling.
Returns a Task
that, when run, races evaluation of this
and t
,
and returns the result of whichever completes first.
Returns a Task
that, when run, races evaluation of this
and t
,
and returns the result of whichever completes first. The losing task
continues to execute in the background though its result will be sent
nowhere.
Create a Task
that will evaluate a
after at least the given delay.
A Task
which returns a TimeoutException
after timeout
,
and attempts to cancel the running computation.
Like run
, but returns exceptions as values.
Like unsafeRunFor
, but returns exceptions as values.
Like unsafeRunFor
, but returns exceptions as values. Both TimeoutException
and other exceptions will be folded into the same Throwable
.
Run this Task
and block until its result is available.
Run this Task
and block until its result is available. This will
throw any exceptions generated by the Task
. To return exceptions
in an Either
, use unsafeAttemptRun
.
Run this computation to obtain either a result or an exception, then invoke the given callback.
Run this computation to obtain either a result or an exception, then
invoke the given callback. Any pure, non-asynchronous computation at the
head of this Future
will be forced in the calling thread. At the first
Async
encountered, control is transferred to whatever thread backs the
Async
and this function returns immediately.
Run this computation and return the result as a standard library Future
.
Run this computation and return the result as a standard library Future
.
Like unsafeRunAsync
but returns a standard library Future
instead of requiring
a callback.
Run this Task
and block until its result is available, or until
timeout
has elapsed, at which point a TimeoutException
will be thrown and the Future
will attempt to be canceled.