Class Scheduler

java.lang.Object
java.lang.Thread
org.bgerp.app.exec.scheduler.Scheduler
All Implemented Interfaces:
Runnable

public class Scheduler extends Thread
Scheduler for running single or periodical tasks.
  • Method Details

    • getInstance

      public static final Scheduler getInstance()
      The singleton instance.
      Returns:
      the scheduler instance
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • runTask

      public void runTask(TaskConfig taskConfig, boolean wait) throws Exception
      Runs a task, optionally waiting for its completion.
      Parameters:
      taskConfig - task configuration
      wait - whether to run synchronously and wait for completion
      Throws:
      Exception - if the task is not runnable or fails
    • getRunningTaskCount

      public int getRunningTaskCount()
      Number of currently running tasks.
      Returns:
      running task count