Package kilim
Class AffineScheduler
java.lang.Object
kilim.Scheduler
kilim.AffineScheduler
- All Implemented Interfaces:
ThreadFactory
- Direct Known Subclasses:
EndPoint.Sched,SessionTask.Sched
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class kilim.Scheduler
Scheduler.BasicLogger, Scheduler.Logger -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AtomicIntegerprotected AffineScheduler.Executor[]protected AtomicIntegerprotected TimerServiceFields inherited from class kilim.Scheduler
defaultLogger, defaultNumberThreads, defaultScheduler, pinnableScheduler, shutdown -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAffineScheduler(int numThreads, int queueSize) create the scheduler -
Method Summary
Modifier and TypeMethodDescriptionvoididledown()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 executedbooleanare 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 emptyprotected intnext()int(package private) voidprotected booleanresolved(TimerService ts) voidschedule a task to runvoidvoidshutdown()booleanwaitIdle(int delay) Methods inherited from class kilim.Scheduler
getCurrentTask, getDefaultPinnable, getDefaultScheduler, getPinnable, isPinnable, isShutdown, log, logRelay, make, schedule, setCurrentTask, setDefaultPinnable, setDefaultScheduler, setLogger
-
Field Details
-
exes
-
index
-
count
-
timerService
-
-
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 onequeueSize- the queue size to use, or use the default if less than one
-
-
Method Details
-
schedule
Description copied from class:Schedulerschedule a task to run -
idledown
public void idledown()Description copied from class:Schedulerblock 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 -
next
protected int next() -
publish
-
scheduleTimer
- Specified by:
scheduleTimerin classScheduler
-
shutdown
public void shutdown() -
numThreads
public int numThreads()- Specified by:
numThreadsin classScheduler
-
waitIdle
public boolean waitIdle(int delay) -
resolved
-
isEmptyish
public boolean isEmptyish()Description copied from class:Schedulerare 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:
isEmptyishin classScheduler
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-