Package rx.internal.schedulers
Class EventLoopsScheduler
java.lang.Object
rx.Scheduler
rx.internal.schedulers.EventLoopsScheduler
- All Implemented Interfaces:
SchedulerLifecycle
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static final class(package private) static final classNested classes/interfaces inherited from class rx.Scheduler
Scheduler.Worker -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringKey to setting the maximum number of computation scheduler threads.(package private) static final intThe maximum number of computation scheduler threads.(package private) static final EventLoopsScheduler.FixedSchedulerPoolThis will indicate no pool is active.(package private) final AtomicReference<EventLoopsScheduler.FixedSchedulerPool> (package private) static final EventLoopsScheduler.PoolWorker(package private) final ThreadFactory -
Constructor Summary
ConstructorsConstructorDescriptionEventLoopsScheduler(ThreadFactory threadFactory) Create a scheduler with pool size equal to the available processor count and using least-recent worker selection policy. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves or creates a newScheduler.Workerthat represents serial execution of actions.scheduleDirect(Action0 action) Schedules the action directly on one of the event loop workers without the additional infrastructure and checking.voidshutdown()Instructs the Scheduler instance to stop threads and stop accepting tasks on any outstanding Workers.voidstart()Allows the Scheduler instance to start threads and accept tasks on them.
-
Field Details
-
KEY_MAX_THREADS
Key to setting the maximum number of computation scheduler threads. Zero or less is interpreted as use available. Capped by available.- See Also:
-
MAX_THREADS
static final int MAX_THREADSThe maximum number of computation scheduler threads. -
SHUTDOWN_WORKER
-
NONE
This will indicate no pool is active. -
threadFactory
-
pool
-
-
Constructor Details
-
EventLoopsScheduler
Create a scheduler with pool size equal to the available processor count and using least-recent worker selection policy.- Parameters:
threadFactory- the factory to use with the executors
-
-
Method Details
-
createWorker
Description copied from class:SchedulerRetrieves or creates a newScheduler.Workerthat represents serial execution of actions.When work is completed it should be unsubscribed using
Subscription.unsubscribe().Work on a
Scheduler.Workeris guaranteed to be sequential.- Specified by:
createWorkerin classScheduler- Returns:
- a Worker representing a serial queue of actions to be executed
-
start
public void start()Description copied from interface:SchedulerLifecycleAllows the Scheduler instance to start threads and accept tasks on them.Implementations should make sure the call is idempotent and threadsafe.
- Specified by:
startin interfaceSchedulerLifecycle
-
shutdown
public void shutdown()Description copied from interface:SchedulerLifecycleInstructs the Scheduler instance to stop threads and stop accepting tasks on any outstanding Workers.Implementations should make sure the call is idempotent and threadsafe.
- Specified by:
shutdownin interfaceSchedulerLifecycle
-
scheduleDirect
Schedules the action directly on one of the event loop workers without the additional infrastructure and checking.- Parameters:
action- the action to schedule- Returns:
- the subscription
-