Package kilim

Class ForkJoinScheduler

    • Field Detail

      • pool

        java.util.concurrent.ForkJoinPool pool
      • count

        private java.util.concurrent.atomic.AtomicInteger count
    • Constructor Detail

      • ForkJoinScheduler

        public ForkJoinScheduler​(int numThreads)
    • Method Detail

      • 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​(java.lang.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
      • 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)
      • processArgs

        private static java.lang.String[] processArgs​(java.lang.String[] args,
                                                      int offset)
      • parseNum

        private static java.lang.Integer parseNum​(java.lang.String[] args,
                                                  int index)
      • run

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

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