Interface DelayTaskRegion


public interface DelayTaskRegion
Lightweight controllable delayed task region interface, responsible for operations such as creation, retrieval, cancellation, and counting of lightweight controllable delayed tasks.
Since:
21.16
Author:
渔民小镇
date:
2024-09-01
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cancel(String taskId)
    Cancel the execution of the controllable delayed task based on taskId.
    int
    Count the number of current delayed tasks
    of(TaskListener taskListener)
    Create a controllable delayed task and set the task listener callback.
    of(String taskId, TaskListener taskListener)
    Create a controllable delayed task, and set the taskId and task listener callback
    optional(String taskId)
    Get an Optional controllable delayed task by taskId
  • Method Details

    • optional

      Optional<DelayTask> optional(String taskId)
      Get an Optional controllable delayed task by taskId
      Parameters:
      taskId - taskId
      Returns:
      DelayTask Optional
    • cancel

      void cancel(String taskId)
      Cancel the execution of the controllable delayed task based on taskId.
      Parameters:
      taskId - taskId
    • count

      int count()
      Count the number of current delayed tasks
      Returns:
      the number of current delayed tasks
    • of

      DelayTask of(TaskListener taskListener)
      Create a controllable delayed task and set the task listener callback.
      DelayTask delayTask = of(taskListener);
      // Start the delayed task
      delayTask.task();
      
      
      Parameters:
      taskListener - task listener callback
      Returns:
      the controllable delayed task
    • of

      DelayTask of(String taskId, TaskListener taskListener)
      Create a controllable delayed task, and set the taskId and task listener callback
      DelayTask delayTask = of(taskId, taskListener);
      // Start the delayed task
      delayTask.task();
      
      
      Parameters:
      taskId - taskId
      taskListener - task listener callback
      Returns:
      the controllable delayed task