Class JKTask

java.lang.Object
com.jk.core.timer.JKTask
All Implemented Interfaces:
Runnable

public abstract class JKTask extends Object implements Runnable
This class is used for defining tasks that can be executed asynchronously.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    The method that gets executed when the task is run.
    This method retrieves the name of the task class.
    boolean
    This method checks if the task has been completed.
    void
    run()
    This method runs the task by invoking the execute method and marking the task as done.
    void
    This method stops the execution of the task.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JKTask

      public JKTask()
  • Method Details

    • run

      public void run()
      This method runs the task by invoking the execute method and marking the task as done.
      Specified by:
      run in interface Runnable
    • execute

      protected abstract void execute()
      The method that gets executed when the task is run.

      Subclasses must implement this method to provide task-specific logic.

    • isDone

      public boolean isDone()
      This method checks if the task has been completed.
      Returns:
      true, if the task has been completed, false otherwise.
    • stop

      public void stop()
      This method stops the execution of the task.

      This method sets the done flag to true and may perform additional cleanup.

    • getName

      public String getName()
      This method retrieves the name of the task class.
      Returns:
      the name of the class implementing the task.