Package 

Class Task

  • All Implemented Interfaces:
    java.util.concurrent.Callable , kotlin.Comparable

    
    public abstract class Task<Result extends Object>
     implements Callable<QueueResult>, Comparable<Task<?>>
                        

    Executable piece of work in the Queue; child classes can do any actual type of work, the Queue does not care. Defines the core principles: dependencies, priority, retry policy and id.

    The generic Result is the value returned via result; use Void (or Unit) when nothing is returned. The type derives priority and the hard-dependency contract. The constructor's initialDependencies seed the dependencies set — additional ones can be added with addDependency until the task is enqueued. The constructor's taskId restricts parallel execution of tasks of the same type: two tasks with the same type and id are considered equal and the Queue (set semantics) rejects duplicates. When the id is null each task is unique — the internal creation order is used.