Package rx.internal.schedulers
Class ExecutorScheduler
- java.lang.Object
-
- rx.Scheduler
-
- rx.internal.schedulers.ExecutorScheduler
-
public final class ExecutorScheduler extends Scheduler
Scheduler that wraps an Executor instance and establishes the Scheduler contract upon it.Note that thread-hopping is unavoidable with this kind of Scheduler as we don't know about the underlying threading behavior of the executor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classExecutorScheduler.ExecutorSchedulerWorkerWorker that schedules tasks on the executor indirectly through a trampoline mechanism.-
Nested classes/interfaces inherited from class rx.Scheduler
Scheduler.Worker
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.Executorexecutor
-
Constructor Summary
Constructors Constructor Description ExecutorScheduler(java.util.concurrent.Executor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Scheduler.WorkercreateWorker()Retrieves or creates a newScheduler.Workerthat represents serial execution of actions.
-
-
-
Method Detail
-
createWorker
public Scheduler.Worker 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
-
-