Package kilim

Class AffineScheduler

java.lang.Object
kilim.Scheduler
kilim.AffineScheduler
All Implemented Interfaces:
ThreadFactory
Direct Known Subclasses:
EndPoint.Sched, SessionTask.Sched

public class AffineScheduler extends Scheduler implements ThreadFactory
  • Field Details

  • Constructor Details

    • AffineScheduler

      protected AffineScheduler()
    • AffineScheduler

      public AffineScheduler(int numThreads, int queueSize)
      create the scheduler
      Parameters:
      numThreads - the number of threads to use, or use the default if less than one
      queueSize - the queue size to use, or use the default if less than one
  • Method Details

    • schedule

      public void schedule(int index, Task t)
      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
      t - the task
    • 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
    • next

      protected int next()
    • publish

      void publish(int index, Task task)
    • scheduleTimer

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

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

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

      public boolean waitIdle(int delay)
    • resolved

      protected boolean resolved(TimerService ts)
    • 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 class Scheduler
    • newThread

      public Thread newThread(Runnable r)
      Specified by:
      newThread in interface ThreadFactory