Note that thread-hopping is unavoidable with this kind of Scheduler as we don't know about the underlying threading behavior of the executor.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | ExecutorScheduler.ExecutorSchedulerWorker
Worker that schedules tasks on the executor indirectly through a trampoline mechanism. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Scheduler. | createWorker()
Implements abstract rx. Scheduler. that represents serial execution of actions.
|
| executor | back to summary |
|---|---|
| pack-priv final Executor executor | |
| ExecutorScheduler | back to summary |
|---|---|
| public ExecutorScheduler(Executor executor) | |
| createWorker | back to summary |
|---|---|
| public Scheduler. Implements abstract rx. Doc from rx. Retrieves or creates a new
When work is completed it should be unsubscribed using
Work on a | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Executor | |
| pack-priv final ConcurrentLinkedQueue | |
| pack-priv final ScheduledExecutorService | |
| pack-priv final CompositeSubscription | |
| pack-priv final AtomicInteger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | isUnsubscribed()
Implements rx. Subscription is currently unsubscribed.
|
| public void | |
| public Subscription | schedule(Action0
Action to schedule action)Implements abstract rx. |
| public Subscription | schedule(Action0
the Action to schedule action, long time to wait before executing the action; non-positive values indicate an non-delayed
schedule delayTime, TimeUnit the time unit of unit)delayTimeImplements abstract rx. |
| public void | unsubscribe()
Implements rx. Subscriber that was registered when this Subscription
was received.
|
| executor | back to summary |
|---|---|
| pack-priv final Executor executor | |
| queue | back to summary |
|---|---|
| pack-priv final ConcurrentLinkedQueue<ScheduledAction> queue | |
| service | back to summary |
|---|---|
| pack-priv final ScheduledExecutorService service | |
| tasks | back to summary |
|---|---|
| pack-priv final CompositeSubscription tasks | |
| wip | back to summary |
|---|---|
| pack-priv final AtomicInteger wip | |
| ExecutorSchedulerWorker | back to summary |
|---|---|
| public ExecutorSchedulerWorker(Executor executor) | |
| isUnsubscribed | back to summary |
|---|---|
| public boolean isUnsubscribed() Implements rx. Doc from rx. Indicates whether this
| |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| schedule | back to summary |
|---|---|
| public Subscription schedule(Action0 action) Implements abstract rx. Doc from rx. Schedules an Action for execution.
| |
| schedule | back to summary |
|---|---|
| public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) Implements abstract rx. Doc from rx. Schedules an Action for execution at some point in the future.
Note to implementors: non-positive
| |
| unsubscribe | back to summary |
|---|---|
| public void unsubscribe() Implements rx. Doc from rx. Stops the receipt of notifications on the
This allows deregistering an
| |