-
- All Implemented Interfaces:
-
com.tds.common.reactor.schedulers.SchedulerLifecycle
public final class EventLoopsScheduler extends Scheduler implements SchedulerLifecycle
-
-
Constructor Summary
Constructors Constructor Description EventLoopsScheduler(ThreadFactory threadFactory)
Create a scheduler with pool size equal to the available processorcount and using least-recent worker selection policy.
-
Method Summary
Modifier and Type Method Description Scheduler.Worker
createWorker()
Retrieves or creates a new Scheduler.Worker that represents serial execution of actions. void
start()
Allows the Scheduler instance to start threadsand accept tasks on them. void
shutdown()
Instructs the Scheduler instance to stop threadsand stop accepting tasks on any outstanding Workers. Subscription
scheduleDirect(Action0 action)
Schedules the action directly on one of the event loop workerswithout the additional infrastructure and checking. -
-
Constructor Detail
-
EventLoopsScheduler
EventLoopsScheduler(ThreadFactory threadFactory)
Create a scheduler with pool size equal to the available processorcount and using least-recent worker selection policy.- Parameters:
threadFactory
- the factory to use with the executors
-
-
Method Detail
-
createWorker
Scheduler.Worker createWorker()
Retrieves or creates a new Scheduler.Worker that represents serial execution of actions.
When work is completed it should be unsubscribed using unsubscribe.
Work on a Scheduler.Worker is guaranteed to be sequential.
-
start
void start()
Allows the Scheduler instance to start threadsand accept tasks on them.
Implementations should make sure the call is idempotent and thread-safe.
-
shutdown
void shutdown()
Instructs the Scheduler instance to stop threadsand stop accepting tasks on any outstanding Workers.
Implementations should make sure the call is idempotent and thread-safe.
-
scheduleDirect
Subscription scheduleDirect(Action0 action)
Schedules the action directly on one of the event loop workerswithout the additional infrastructure and checking.
- Parameters:
action
- the action to schedule
-
-
-
-