-
- All Implemented Interfaces:
-
com.tds.common.reactor.Subscription
public final class BooleanSubscription implements Subscription
Subscription that can be checked for status such as in a loop inside an Observable to exit the loop if unsubscribed.
-
-
Constructor Summary
Constructors Constructor Description BooleanSubscription()
-
Method Summary
Modifier and Type Method Description static BooleanSubscription
create()
Creates a {@code BooleanSubscription}
without unsubscribe behavior.static BooleanSubscription
create(Action0 onUnsubscribe)
Creates a {@code BooleanSubscription}
with a specified function to invoke upon unsubscribe.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. -
-
Method Detail
-
create
static BooleanSubscription create()
Creates a
{@code BooleanSubscription}
without unsubscribe behavior.
-
create
static BooleanSubscription create(Action0 onUnsubscribe)
Creates a
{@code BooleanSubscription}
with a specified function to invoke upon unsubscribe.- Parameters:
onUnsubscribe
- an Action0 to invoke upon unsubscribe
-
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).
-
-
-
-