Interface Task<T>

Type Parameters:
T - result type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Deprecated @FunctionalInterface public interface Task<T>
Deprecated.
Experimental API
Represents a possibly asynchronous unit of work, called "Task".

A Task is a function that takes an instance of Task.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 Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Deprecated.
    Completes a task.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run(Task.Complete<T> complete)
    Deprecated.
    Runs the task.
  • Method Details

    • run

      void run(Task.Complete<T> complete) throws Throwable
      Deprecated.
      Runs the task. Non-fatal errors are catched by a Future.
      Parameters:
      complete - a function that completes this task
      Throws:
      Throwable - if an error occurs