Package kilim

Class ForkJoinScheduler

java.lang.Object
kilim.Scheduler
kilim.ForkJoinScheduler
All Implemented Interfaces:
TimerService.WatchdogContext

public class ForkJoinScheduler extends Scheduler implements TimerService.WatchdogContext
  • Field Details

  • Constructor Details

    • ForkJoinScheduler

      public ForkJoinScheduler(int numThreads)
  • Method Details

    • publish

      public void publish(TimerService.WatchdogTask dog)
      Specified by:
      publish in interface TimerService.WatchdogContext
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface TimerService.WatchdogContext
    • isPinnable

      public boolean isPinnable()
      Overrides:
      isPinnable in class Scheduler
    • schedule

      public void schedule(int index, Task task)
      Description copied from class: Scheduler
      schedule a task to run
      Specified by:
      schedule in class Scheduler
      Parameters:
      index - the index of the executor to use, or less than zero to use the default (round robin) assignment
      task - the task
    • publish

      public void publish(Runnable task)
    • isEmptyish

      public boolean isEmptyish()
      Description copied from class: Scheduler
      are the queues empty allows false positives, but not false negatives ie, if this method returns false, then at some moment during the call at least one queue was non-empty if it returns true then for each queue there was a moment during the call when it was empty
      Specified by:
      isEmptyish in interface TimerService.WatchdogContext
      Specified by:
      isEmptyish in class Scheduler
    • numThreads

      public int numThreads()
      Specified by:
      numThreads in class Scheduler
    • scheduleTimer

      public void scheduleTimer(Timer t)
      Specified by:
      scheduleTimer in class Scheduler
    • idledown

      public void idledown()
      Description copied from class: Scheduler
      block the thread till a moment at which all scheduled tasks have completed and then shutdown the scheduler does not prevent scheduling new tasks (from other threads) until the shutdown is complete so such a task could be partially executed
      Specified by:
      idledown in class Scheduler
    • waitIdle

      public boolean waitIdle(int delay)
    • shutdown

      public void shutdown()
      Overrides:
      shutdown in class Scheduler
    • processArgs

      private static String[] processArgs(String[] args, int offset)
    • parseNum

      private static Integer parseNum(String[] args, int index)
    • run

      private static void run(String className, String method, String... args) throws Exception
      Throws:
      Exception
    • main

      public static void main(String[] args) throws Exception
      run the main method from another class using this scheduler as the default scheduler
      Throws:
      Exception