public final class ScheduledAction extends java.lang.Object implements java.lang.Runnable, Subscription
Runnable
that executes an Action0
and can be cancelled. The analogue is the
Subscriber
in respect of an Observer
.Constructor and Description |
---|
ScheduledAction(Action0 action) |
Modifier and Type | Method and Description |
---|---|
void |
add(Subscription s) |
void |
addParent(CompositeSubscription parent)
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. |
public ScheduledAction(Action0 action)
public void run()
run
in interface java.lang.Runnable
public boolean isUnsubscribed()
Subscription
Subscription
is currently unsubscribed.isUnsubscribed
in interface Subscription
true
if this Subscription
is currently unsubscribed, false
otherwisepublic 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).
unsubscribe
in interface Subscription
public void add(Subscription s)
s
- public void addParent(CompositeSubscription parent)
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