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 class
ExecutorScheduler.ExecutorSchedulerWorker
Worker 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.Executor
executor
-
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.Worker
createWorker()
Retrieves or creates a newScheduler.Worker
that represents serial execution of actions.
-
-
-
Method Detail
-
createWorker
public Scheduler.Worker createWorker()
Description copied from class:Scheduler
Retrieves or creates a newScheduler.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.- Specified by:
createWorker
in classScheduler
- Returns:
- a Worker representing a serial queue of actions to be executed
-
-