Interface Task<R,S>

Type Parameters:
R - the result type. Nullable.
S - the secondary result type. usually contains information about the task's execution process. NotNull.
All Superinterfaces:
HasAsyncManager
All Known Subinterfaces:
ConditionedTask<R,S>, ExecutableTask<R,S>, PTask<R,S>, Queueable<T,R>
All Known Implementing Classes:
CompletableTask, ExecutableTaskBase, QueueableBase

public interface Task<R,S> extends HasAsyncManager

A Task can be executed asynchronous or in the current thread.


Example asynchronous execution:

 Task<String, Nothing> task = ...;

 //Queue and create a listener.
 //This creates a Future.
 task.queue((result, response, error) -> {
             if(error != null) {
                 System.out.println("could not execute task.");
                 //Handle error
                 return;
             }

             //Process result...
             System.out.println("Result: " + result);
         });
 

For Information on how to create your own Task, see ExecutableTaskBase, QueueableBase and CompletableTask.

See Also: