public final class SubscriptionIndexedRingBuffer<T extends Subscription> extends java.lang.Object implements Subscription
NOTE: This purposefully is leaking the internal data structure through the API for efficiency reasons to avoid extra object allocations.
Constructor and Description |
---|
SubscriptionIndexedRingBuffer() |
SubscriptionIndexedRingBuffer(T... subscriptions) |
Modifier and Type | Method and Description |
---|---|
int |
add(T s)
Adds a new
Subscription to this CompositeSubscription if the CompositeSubscription is not yet unsubscribed. |
int |
forEach(Func1<T,java.lang.Boolean> action) |
int |
forEach(Func1<T,java.lang.Boolean> action,
int startIndex) |
boolean |
isUnsubscribed()
Indicates whether this
Subscription is currently unsubscribed. |
void |
remove(int n)
Uses the Node received from `add` to remove this Subscription.
|
void |
removeSilently(int n)
Uses the Node received from `add` to remove this Subscription.
|
void |
unsubscribe()
Stops the receipt of notifications on the
Subscriber that was registered when this Subscription
was received. |
public SubscriptionIndexedRingBuffer()
public SubscriptionIndexedRingBuffer(T... subscriptions)
public boolean isUnsubscribed()
Subscription
Subscription
is currently unsubscribed.isUnsubscribed
in interface Subscription
true
if this Subscription
is currently unsubscribed, false
otherwisepublic int add(T s)
Subscription
to this CompositeSubscription
if the CompositeSubscription
is not yet unsubscribed. If the CompositeSubscription
is
unsubscribed, add
will indicate this by explicitly unsubscribing the new Subscription
as
well.s
- the Subscription
to addpublic void remove(int n)
Unsubscribes the Subscription after removal
public void removeSilently(int n)
Does not unsubscribe the Subscription after removal.
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).
unsubscribe
in interface Subscription