-
- All Implemented Interfaces:
-
com.tds.common.reactor.Subscription
,java.io.Serializable
,java.lang.Runnable
public final class ScheduledAction extends AtomicReference<Thread> implements Runnable, Subscription
A
{@code Runnable}
that executes an{@code Action0}
and can be cancelled. The analog is the{@code Subscriber}
in respect of an{@code Observer}
.
-
-
Constructor Summary
Constructors Constructor Description ScheduledAction(Action0 action)
ScheduledAction(Action0 action, CompositeSubscription parent)
ScheduledAction(Action0 action, SubscriptionList parent)
-
Method Summary
Modifier and Type Method Description void
run()
boolean
isUnsubscribed()
Indicates whether this {@code Subscription}
is currently unsubscribed.void
unsubscribe()
Stops the receipt of notifications on the Subscriber that was registered when this Subscriptionwas received. void
add(Subscription s)
Adds a general Subscription to this {@code ScheduledAction}
that will be unsubscribedif the underlying{@code action}
completes or the this scheduled action is cancelled.void
add(Future<out Object> f)
void
addParent(SubscriptionList parent)
void
addParent(CompositeSubscription parent)
-
Methods inherited from class java.util.concurrent.atomic.AtomicReference
accumulateAndGet, compareAndSet, get, getAndAccumulate, getAndSet, getAndUpdate, lazySet, set, toString, updateAndGet, weakCompareAndSet
-
Methods inherited from class java.lang.Runnable
run
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ScheduledAction
ScheduledAction(Action0 action)
-
ScheduledAction
ScheduledAction(Action0 action, CompositeSubscription parent)
-
ScheduledAction
ScheduledAction(Action0 action, SubscriptionList parent)
-
-
Method Detail
-
run
void run()
-
isUnsubscribed
boolean isUnsubscribed()
Indicates whether this
{@code Subscription}
is currently unsubscribed.
-
unsubscribe
void unsubscribe()
Stops the receipt of notifications on the Subscriber that was registered when this Subscriptionwas received.
This allows deregistering an Subscriber before it has finished receiving all events (i.e. beforeonCompleted is called).
-
add
void add(Subscription s)
Adds a general Subscription to this
{@code ScheduledAction}
that will be unsubscribedif the underlying{@code action}
completes or the this scheduled action is cancelled.- Parameters:
s
- the Subscription to add
-
addParent
void addParent(SubscriptionList parent)
-
addParent
void addParent(CompositeSubscription parent)
-
-
-
-