Package rx.internal.schedulers
Class TrampolineScheduler.InnerCurrentThreadScheduler
- java.lang.Object
-
- rx.Scheduler.Worker
-
- rx.internal.schedulers.TrampolineScheduler.InnerCurrentThreadScheduler
-
- All Implemented Interfaces:
Subscription
- Enclosing class:
- TrampolineScheduler
static final class TrampolineScheduler.InnerCurrentThreadScheduler extends Scheduler.Worker implements Subscription
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.atomic.AtomicIntegercounterprivate BooleanSubscriptioninnerSubscription(package private) java.util.concurrent.PriorityBlockingQueue<TrampolineScheduler.TimedAction>queueprivate java.util.concurrent.atomic.AtomicIntegerwip
-
Constructor Summary
Constructors Constructor Description InnerCurrentThreadScheduler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Subscriptionenqueue(Action0 action, long execTime)booleanisUnsubscribed()Indicates whether thisSubscriptionis currently unsubscribed.Subscriptionschedule(Action0 action)Schedules an Action for execution.Subscriptionschedule(Action0 action, long delayTime, java.util.concurrent.TimeUnit unit)Schedules an Action for execution at some point in the future.voidunsubscribe()Stops the receipt of notifications on theSubscriberthat was registered when this Subscription was received.-
Methods inherited from class rx.Scheduler.Worker
now, schedulePeriodically
-
-
-
-
Field Detail
-
counter
final java.util.concurrent.atomic.AtomicInteger counter
-
queue
final java.util.concurrent.PriorityBlockingQueue<TrampolineScheduler.TimedAction> queue
-
innerSubscription
private final BooleanSubscription innerSubscription
-
wip
private final java.util.concurrent.atomic.AtomicInteger wip
-
-
Method Detail
-
schedule
public Subscription schedule(Action0 action)
Description copied from class:Scheduler.WorkerSchedules an Action for execution.- Specified by:
schedulein classScheduler.Worker- Parameters:
action- Action to schedule- Returns:
- a subscription to be able to unsubscribe the action (unschedule it if not executed)
-
schedule
public Subscription schedule(Action0 action, long delayTime, java.util.concurrent.TimeUnit unit)
Description copied from class:Scheduler.WorkerSchedules an Action for execution at some point in the future.Note to implementors: non-positive
delayTimeshould be regarded as undelayed schedule, i.e., as if theScheduler.Worker.schedule(rx.functions.Action0)was called.- Specified by:
schedulein classScheduler.Worker- Parameters:
action- the Action to scheduledelayTime- time to wait before executing the action; non-positive values indicate an undelayed scheduleunit- the time unit ofdelayTime- Returns:
- a subscription to be able to unsubscribe the action (unschedule it if not executed)
-
enqueue
private Subscription enqueue(Action0 action, long execTime)
-
unsubscribe
public void unsubscribe()
Description copied from interface:SubscriptionStops the receipt of notifications on theSubscriberthat was registered when this Subscription was received.This allows unregistering an
Subscriberbefore it has finished receiving all events (i.e. before onCompleted is called).- Specified by:
unsubscribein interfaceSubscription
-
isUnsubscribed
public boolean isUnsubscribed()
Description copied from interface:SubscriptionIndicates whether thisSubscriptionis currently unsubscribed.- Specified by:
isUnsubscribedin interfaceSubscription- Returns:
trueif thisSubscriptionis currently unsubscribed,falseotherwise
-
-