public final class EventLoopsScheduler extends Scheduler implements SchedulerLifecycle
Scheduler.Worker
Constructor and Description |
---|
EventLoopsScheduler(ThreadFactory threadFactory)
Create a scheduler with pool size equal to the available processor
count and using least-recent worker selection policy.
|
Modifier and Type | Method and Description |
---|---|
Scheduler.Worker |
createWorker()
Retrieves or creates a new
Scheduler.Worker that represents serial execution of actions. |
Subscription |
scheduleDirect(Action0 action)
Schedules the action directly on one of the event loop workers
without the additional infrastructure and checking.
|
void |
shutdown()
Instructs the Scheduler instance to stop threads
and stop accepting tasks on any outstanding Workers.
|
void |
start()
Allows the Scheduler instance to start threads
and accept tasks on them.
|
public EventLoopsScheduler(ThreadFactory threadFactory)
threadFactory
- the factory to use with the executorspublic Scheduler.Worker createWorker()
Scheduler
Scheduler.Worker
that represents serial execution of actions.
When work is completed it should be unsubscribed using Subscription.unsubscribe()
.
Work on a Scheduler.Worker
is guaranteed to be sequential.
createWorker
in class Scheduler
public void start()
SchedulerLifecycle
Implementations should make sure the call is idempotent and thread-safe.
start
in interface SchedulerLifecycle
public void shutdown()
SchedulerLifecycle
Implementations should make sure the call is idempotent and thread-safe.
shutdown
in interface SchedulerLifecycle
public Subscription scheduleDirect(Action0 action)
action
- the action to scheduleCopyright © 2017. All rights reserved.