public class AffineScheduler extends Scheduler implements java.util.concurrent.ThreadFactory
| Modifier and Type | Class and Description |
|---|---|
protected class |
AffineScheduler.Executor |
Scheduler.Logger| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.atomic.AtomicInteger |
count |
protected AffineScheduler.Executor[] |
exes |
protected java.util.concurrent.atomic.AtomicInteger |
index |
protected TimerService |
timerService |
defaultLogger, defaultNumberThreads, defaultScheduler, pinnableScheduler, shutdown| Modifier | Constructor and Description |
|---|---|
protected |
AffineScheduler() |
|
AffineScheduler(int numThreads,
int queueSize)
create the scheduler
|
| Modifier and Type | Method and Description |
|---|---|
void |
idledown()
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
|
boolean |
isEmptyish()
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
|
java.lang.Thread |
newThread(java.lang.Runnable r) |
protected int |
next() |
int |
numThreads() |
protected boolean |
resolved(TimerService ts) |
void |
schedule(int index,
Task t)
schedule a task to run
|
void |
scheduleTimer(Timer t) |
void |
shutdown() |
boolean |
waitIdle(int delay) |
getCurrentTask, getDefaultPinnable, getDefaultScheduler, getPinnable, isPinnable, isShutdown, log, logRelay, make, schedule, setCurrentTask, setDefaultPinnable, setDefaultScheduler, setLoggerprotected AffineScheduler.Executor[] exes
protected java.util.concurrent.atomic.AtomicInteger index
protected java.util.concurrent.atomic.AtomicInteger count
protected TimerService timerService
protected AffineScheduler()
public AffineScheduler(int numThreads,
int queueSize)
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 onepublic void schedule(int index,
Task t)
Schedulerpublic void idledown()
Schedulerprotected int next()
public void scheduleTimer(Timer t)
scheduleTimer in class Schedulerpublic int numThreads()
numThreads in class Schedulerpublic boolean waitIdle(int delay)
protected boolean resolved(TimerService ts)
public boolean isEmptyish()
SchedulerisEmptyish in class Schedulerpublic java.lang.Thread newThread(java.lang.Runnable r)
newThread in interface java.util.concurrent.ThreadFactory