Top Description Inners Methods
io.vavr.concurrent

public Interface Task<T>

Annotations
@Deprecated
@FunctionalInterface
Type Parameters
<T>
result type
Imports
io.vavr.control.Try

Deprecated

Experimental API

Represents a possibly asynchronous unit of work, called "Task".

A Task is a function that takes an instance of Complete and returns nothing.

Complete is a handler that needs to be actively called to complete the Task.

Callable<T> worker = ...;
Future<T> result = Future.run(complete -> complete.with(Try.of(worker::call)));

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Task.Complete<
result type
T
>

Completes a task.

Method Summary

Modifier and TypeMethod and Description
public void
run(Task.Complete<T>
a function that completes this task
complete
)

Runs the task.

Method Detail

runback to summary
public void run(Task.Complete<T> complete) throws Throwable

Runs the task. Non-fatal errors are catched by a Future.

Parameters
complete:Task.Complete<T>

a function that completes this task

Exceptions
Throwable:
if an error occurs
io.vavr.concurrent back to summary

public Interface Task.Complete<T>

Annotations
@FunctionalInterface
Type Parameters
<T>
result type

Completes a task.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true, if the task could be completed, otherwise false. Successive calls will result in false.
with
(Try<? extends T>
the computation result
value
)

A function that takes a Try (success or failure) and returns the state of completion.

Method Detail

withback to summary
public boolean with(Try<? extends T> value)

A function that takes a Try (success or failure) and returns the state of completion.

Parameters
value:Try<? extends T>

the computation result

Returns:boolean

true, if the task could be completed, otherwise false. Successive calls will result in false.