Package kilim
Class AffineScheduler
- java.lang.Object
-
- kilim.Scheduler
-
- kilim.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAffineScheduler.Executor-
Nested classes/interfaces inherited from class kilim.Scheduler
Scheduler.BasicLogger, Scheduler.Logger
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.atomic.AtomicIntegercountprotected AffineScheduler.Executor[]exesprotected java.util.concurrent.atomic.AtomicIntegerindexprotected TimerServicetimerService-
Fields inherited from class kilim.Scheduler
defaultLogger, defaultNumberThreads, defaultScheduler, pinnableScheduler, shutdown
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAffineScheduler()AffineScheduler(int numThreads, int queueSize)create the scheduler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voididledown()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 executedbooleanisEmptyish()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 emptyjava.lang.ThreadnewThread(java.lang.Runnable r)protected intnext()intnumThreads()(package private) voidpublish(int index, Task task)protected booleanresolved(TimerService ts)voidschedule(int index, Task t)schedule a task to runvoidscheduleTimer(Timer t)voidshutdown()booleanwaitIdle(int delay)-
Methods inherited from class kilim.Scheduler
getCurrentTask, getDefaultPinnable, getDefaultScheduler, getPinnable, isPinnable, isShutdown, log, logRelay, make, schedule, setCurrentTask, setDefaultPinnable, setDefaultScheduler, setLogger
-
-
-
-
Field Detail
-
exes
protected AffineScheduler.Executor[] exes
-
index
protected java.util.concurrent.atomic.AtomicInteger index
-
count
protected java.util.concurrent.atomic.AtomicInteger count
-
timerService
protected TimerService timerService
-
-
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 onequeueSize- 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: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
void publish(int index, Task task)
-
scheduleTimer
public void scheduleTimer(Timer t)
- Specified by:
scheduleTimerin classScheduler
-
numThreads
public int numThreads()
- Specified by:
numThreadsin classScheduler
-
waitIdle
public boolean waitIdle(int delay)
-
resolved
protected boolean resolved(TimerService ts)
-
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
public java.lang.Thread newThread(java.lang.Runnable r)
- Specified by:
newThreadin interfacejava.util.concurrent.ThreadFactory
-
-