public final class ScheduledAction extends AtomicReference<Thread > implements Runnable , Subscription
Runnable that executes an
Action0 and can be cancelled. The analog is the
Subscriber in respect of an
Observer.
| Constructor and Description |
|---|
ScheduledAction(Action0
|
ScheduledAction(Action0
|
ScheduledAction(Action0
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Future
Adds the given Future to the unsubscription composite in order to support cancelling the underlying task in the executor framework.
|
void |
add(Subscription
Adds a general Subscription to this
ScheduledAction that will be unsubscribed if the underlying
action completes or the this scheduled action is cancelled.
|
void |
addParent(CompositeSubscription
Adds a parent
CompositeSubscription to this
ScheduledAction so when the action is cancelled or terminates, it can remove itself from this parent.
|
void |
addParent(SubscriptionList
Adds a parent
CompositeSubscription to this
ScheduledAction so when the action is cancelled or terminates, it can remove itself from this parent.
|
boolean |
isUnsubscribed()
Indicates whether this
Subscription is currently unsubscribed.
|
void |
run()
|
void |
unsubscribe()
Stops the receipt of notifications on the
Subscriber that was registered when this Subscription was received.
|
accumulateAndGet, compareAndSet, get, getAndAccumulate, getAndSet, getAndUpdate, lazySet, set, toString, updateAndGet, weakCompareAndSetpublic ScheduledAction(Action0action)
public ScheduledAction(Action0action, CompositeSubscription parent)
public ScheduledAction(Action0action, SubscriptionList parent)
public void run()
public boolean isUnsubscribed()
Subscription
Subscription is currently unsubscribed.
isUnsubscribed in interface
Subscription
true if this
Subscription is currently unsubscribed,
false otherwise
public void unsubscribe()
Subscription
Subscriber that was registered when this Subscription was received.
This allows unregistering an Subscriber before it has finished receiving all events (i.e. before onCompleted is called).
public void add(Subscriptions)
ScheduledAction that will be unsubscribed if the underlying
action completes or the this scheduled action is cancelled.
s - the Subscription to add
public void add(Future<?> f)
f - the future to add
public void addParent(CompositeSubscriptionparent)
CompositeSubscription to this
ScheduledAction so when the action is cancelled or terminates, it can remove itself from this parent.
parent - the parent
CompositeSubscription to add
public void addParent(SubscriptionListparent)
CompositeSubscription to this
ScheduledAction so when the action is cancelled or terminates, it can remove itself from this parent.
parent - the parent
CompositeSubscription to add