Package kilim
Class ForkJoinScheduler
java.lang.Object
kilim.Scheduler
kilim.ForkJoinScheduler
- All Implemented Interfaces:
TimerService.WatchdogContext
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final classNested classes/interfaces inherited from class kilim.Scheduler
Scheduler.BasicLogger, Scheduler.Logger -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicInteger(package private) ForkJoinPoolprivate TimerServiceFields inherited from class kilim.Scheduler
defaultLogger, defaultNumberThreads, defaultScheduler, pinnableScheduler, shutdown -
Constructor Summary
Constructors -
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 executedbooleanisEmpty()booleanare 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 emptybooleanstatic voidrun the main method from another class using this scheduler as the default schedulerintprivate static Integerprivate static String[]processArgs(String[] args, int offset) voidvoidprivate static voidvoidschedule a task to runvoidvoidshutdown()booleanwaitIdle(int delay) Methods inherited from class kilim.Scheduler
getCurrentTask, getDefaultPinnable, getDefaultScheduler, getPinnable, isShutdown, log, logRelay, make, schedule, setCurrentTask, setDefaultPinnable, setDefaultScheduler, setLogger
-
Field Details
-
pool
ForkJoinPool pool -
timerService
-
count
-
-
Constructor Details
-
ForkJoinScheduler
public ForkJoinScheduler(int numThreads)
-
-
Method Details
-
publish
- Specified by:
publishin interfaceTimerService.WatchdogContext
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceTimerService.WatchdogContext
-
isPinnable
public boolean isPinnable()- Overrides:
isPinnablein classScheduler
-
schedule
Description copied from class:Schedulerschedule a task to run -
publish
-
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 interfaceTimerService.WatchdogContext- Specified by:
isEmptyishin classScheduler
-
numThreads
public int numThreads()- Specified by:
numThreadsin classScheduler
-
scheduleTimer
- Specified by:
scheduleTimerin classScheduler
-
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 -
waitIdle
public boolean waitIdle(int delay) -
shutdown
public void shutdown() -
processArgs
-
parseNum
-
run
- Throws:
Exception
-
main
run the main method from another class using this scheduler as the default scheduler- Throws:
Exception
-