Package kilim

Class AffineScheduler

  • All Implemented Interfaces:
    java.util.concurrent.ThreadFactory
    Direct Known Subclasses:
    EndPoint.Sched, SessionTask.Sched

    public class AffineScheduler
    extends Scheduler
    implements java.util.concurrent.ThreadFactory
    • Field Detail

      • index

        protected java.util.concurrent.atomic.AtomicInteger index
      • count

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

      • 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 Detail

      • 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)
      • 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 java.lang.Thread newThread​(java.lang.Runnable r)
        Specified by:
        newThread in interface java.util.concurrent.ThreadFactory