Delays the execution of this Task by the duration t.
'Catches' exceptions in the given task and returns them as values.
Ensures that 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.
Retries this task if it fails, once for each element in delays,
each retry delayed by the corresponding duration.
Retries this task if it fails, once for each element in delays,
each retry delayed by the corresponding duration.
A retriable failure is one for which the predicate p returns true.
Retries this task if it fails, once for each element in delays,
each retry delayed by the corresponding duration, accumulating
errors into a list.
Retries this task if it fails, once for each element in delays,
each retry delayed by the corresponding duration, accumulating
errors into a list.
A retriable failure is one for which the predicate p returns true.
A Task which returns a TimeoutException after timeoutInMillis,
and attempts to cancel the running computation.
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 Task will be forced in the calling thread. At the first
Async encountered, control to whatever thread backs the Async and
this function returns immediately.
Similar to unsafePerformAsyncInterruptibly(f,cancel) except instead of interrupting by setting cancel to true,
It returns the function, that, when applied will interrupt the task.
Similar to unsafePerformAsyncInterruptibly(f,cancel) except instead of interrupting by setting cancel to true,
It returns the function, that, when applied will interrupt the task.
This allows "deterministic" completion of task computation
even if it was interrupted.
That means task will complete even when interrupted,
but with TaskInterrupted exception.
Note 1: When Interrupted, the f callback will run in thread that called the Interrupting function () => Unit
Note 2: If task has handler like attempt, it won't get consulted for handling TaskInterrupted exception
Run this computation to obtain an A, so long as cancel remains false.
Run this computation to obtain an A, so long as cancel remains false.
Because of trampolining, we get frequent opportunities to cancel
while stepping through the trampoline, this should provide a fairly
robust means of cancellation.
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 \/, use unsafePerformSyncAttempt.
Like unsafePerformSync, but returns exceptions as values.
Like unsafePerformSyncFor, but returns exceptions as values.
Like unsafePerformSyncFor, 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, or until
timeoutInMillis milliseconds have elapsed, at which point a TimeoutException
will be thrown and the Task will attempt to be canceled.
(Since version 7.2) use unsafePerformSyncAttempt
(Since version 7.2) use unsafePerformSyncAttemptFor
(Since version 7.2) use unsafePerformSyncAttemptFor
(Since version 7.2) use unsafePerformSync
(Since version 7.2) use unsafePerformAsync
(Since version 7.2) use unsafePerformAsyncInterruptibly
(Since version 7.2) use unsafePerformAsyncInterruptibly
(Since version 7.2) use unsafePerformSyncFor
(Since version 7.2) use unsafePerformSyncFor
(Since version 7.2) use retry
(Since version 7.2) use retryAccumulating
(Since version 7.2) use timed
(Since version 7.2) use timed
Task[A]wraps ascalaz.concurrent.Future[Throwable \/ A], with some convenience functions for handling exceptions. ItsMonadandNondeterminisminstances are derived from Future.Task(andFuture) differ in several key ways from theFutureimplementation in Scala 2.10 , and have a number of advantages. See the documentation for scalaz.concurrent.Future for more information.Taskis exception-safe when constructed using the primitives in the companion object, but when calling the constructor, you are responsible for ensuring the exception safety of the providedFuture.