Interface Task

All Known Implementing Classes:
TaskProvider

public interface Task
Provides asynchronous task execution and scheduling functionality.

This interface allows the execution of tasks asynchronously on a specified target thread and supports optional delayed execution.

Since:
1.0.0
  • Method Details

    • run

      <T> void run(Callable<T> action, Consumer<T> onSuccess, TargetThread targetThread)
      Executes a given task on a specified target thread and returns the result.
      Type Parameters:
      T - The type of the result produced by the task.
      Parameters:
      action - The supplier representing the task to be executed. This task will be executed on the specified thread.
      onSuccess - The action to be run on success
      targetThread - The thread on which the task should be executed.
    • run

      <T> void run(Callable<T> action, Consumer<T> onSuccess, Runnable onFailure, TargetThread targetThread)
      Executes a given task on a specified target thread and returns the result.
      Type Parameters:
      T - The type of the result produced by the task.
      Parameters:
      action - The supplier representing the task to be executed. This task will be executed on the specified thread.
      onSuccess - The action to be run on success
      onFailure - The action to be run on failure
      targetThread - The thread on which the task should be executed.
    • run

      void run(Runnable action, TargetThread targetThread)
      Executes a given task on a specified target thread.
      Parameters:
      action - The runnable task to be executed. This task will be executed on the specified thread.
      targetThread - The thread on which the task should be executed. This specifies the execution context for the task.
    • schedule

      <T> void schedule(Callable<T> action, Consumer<T> onSuccess, UnitNumber<TimeUnit> delay, TargetThread targetThread)
      Schedules a task for execution on a specified target thread after a specified delay and returns the result of the task execution.
      Type Parameters:
      T - The type of the result produced by the task.
      Parameters:
      action - The supplier representing the task to be executed. This task will be executed on the specified thread after the delay.
      onSuccess - The action to be run when the task is complete.
      delay - The delay before the task is executed.
      targetThread - The thread on which the task should be executed.
    • schedule

      <T> void schedule(Callable<T> action, Consumer<T> onSuccess, Runnable onFailure, UnitNumber<TimeUnit> delay, TargetThread targetThread)
      Schedules a task for execution on a specified target thread after a specified delay and returns the result of the task execution.
      Type Parameters:
      T - The type of the result produced by the task.
      Parameters:
      action - The supplier representing the task to be executed. This task will be executed on the specified thread after the delay.
      onSuccess - The action to be run when the task is complete.
      onFailure - The action to be run on failure.
      delay - The delay before the task is executed.
      targetThread - The thread on which the task should be executed.
    • schedule

      void schedule(Runnable action, UnitNumber<TimeUnit> delay, TargetThread targetThread)
      Schedules a task for execution on a specified target thread after a specified delay.
      Parameters:
      action - The runnable task to be executed. This task will be scheduled to run on the specified thread after the delay period has elapsed.
      delay - The delay before the task is executed.
      targetThread - The thread on which the task should be executed. This specifies the execution context for the task.