Top Description Fields Constructors Methods
rx

public abstract Class SingleSubscriber<T>

extends Object
implements Subscription
Class Inheritance
All Implemented Interfaces
rx.Subscription
Known Direct Subclasses
rx.internal.operators.CompletableFlatMapSingleToCompletable.SourceSubscriber, rx.internal.operators.OnSubscribeFlatMapSingle.FlatMapSingleSubscriber.InnerSubscriber, rx.internal.operators.OnSubscribeOnAssemblySingle.OnAssemblySingleSubscriber, rx.internal.operators.SingleDelay.ObserveOnSingleSubscriber, rx.internal.operators.SingleDoAfterTerminate.SingleDoAfterTerminateSubscriber, rx.internal.operators.SingleDoOnEvent.SingleDoOnEventSubscriber, rx.internal.operators.SingleLiftObservableOperator.WrapSubscriberIntoSingle, rx.internal.operators.SingleObserveOn.ObserveOnSingleSubscriber, rx.internal.operators.SingleOnErrorReturn.OnErrorReturnsSingleSubscriber, rx.internal.operators.SingleOnSubscribeMap.MapSubscriber, rx.internal.operators.SingleTakeUntilCompletable.TakeUntilSourceSubscriber, rx.internal.operators.SingleTakeUntilObservable.TakeUntilSourceSubscriber, rx.internal.operators.SingleTakeUntilSingle.TakeUntilSourceSubscriber, rx.internal.operators.SingleTakeUntilSingle.TakeUntilSourceSubscriber.OtherSubscriber, rx.internal.operators.SingleTimeout.TimeoutSingleSubscriber, rx.internal.operators.SingleTimeout.TimeoutSingleSubscriber.OtherSubscriber
Type Parameters
<T>
the type of item the SingleSubscriber expects to observe
Imports
rx.internal.util.SubscriptionList

Provides a mechanism for receiving push-based notifications.

After a SingleSubscriber calls a Single's subscribe method, the Single calls the SingleSubscriber's onSuccess and onError methods to provide notifications. A well-behaved Single will call a SingleSubscriber's onSuccess method exactly once or the SingleSubscriber's onError method exactly once.

Note, that if you want isUnsubscribed to return true after onSuccess or onError invocation, you need to invoke unsubscribe in these methods.

Since
1.2
See Also
ReactiveX documentation: Observable

Field Summary

Modifier and TypeField and Description
private final SubscriptionList

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
add(Subscription
the Subscription to add
s
)

Adds a Subscription to this Subscriber's list of subscriptions if this list is not marked as unsubscribed.

public final boolean

Returns:

true if this Subscriber has unsubscribed from its subscriptions, false otherwise
isUnsubscribed
()

Implements rx.Subscription.isUnsubscribed.

Indicates whether this Subscriber has unsubscribed from its list of subscriptions.
public abstract void
onError(Throwable
the exception encountered by the Single
error
)

Notifies the SingleSubscriber that the Single has experienced an error condition.

public abstract void
onSuccess(T
the item emitted by the Single
t
)

Notifies the SingleSubscriber with a single item and that the Single has finished sending push-based notifications.

public final void
unsubscribe()

Implements rx.Subscription.unsubscribe.

Stops the receipt of notifications on the Subscriber that was registered when this Subscription was received.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

csback to summary
private final SubscriptionList cs

Constructor Detail

SingleSubscriberback to summary
public SingleSubscriber()

Method Detail

addback to summary
public final void add(Subscription s)

Adds a Subscription to this Subscriber's list of subscriptions if this list is not marked as unsubscribed. If the list is marked as unsubscribed, add will indicate this by explicitly unsubscribing the new Subscription as well.

Parameters
s:Subscription

the Subscription to add

isUnsubscribedback to summary
public final boolean isUnsubscribed()

Implements rx.Subscription.isUnsubscribed.

Indicates whether this Subscriber has unsubscribed from its list of subscriptions.

Returns:boolean

true if this Subscriber has unsubscribed from its subscriptions, false otherwise

Annotations
@Override
onErrorback to summary
public abstract void onError(Throwable error)

Notifies the SingleSubscriber that the Single has experienced an error condition.

If the Single calls this method, it will not thereafter call onSuccess.

Parameters
error:Throwable

the exception encountered by the Single

onSuccessback to summary
public abstract void onSuccess(T t)

Notifies the SingleSubscriber with a single item and that the Single has finished sending push-based notifications.

The Single will not call this method if it calls onError.

Parameters
t:T

the item emitted by the Single

unsubscribeback to summary
public final void unsubscribe()

Implements rx.Subscription.unsubscribe.

Doc from rx.Subscription.unsubscribe.

Stops the receipt of notifications on the Subscriber that was registered when this Subscription was received.

This allows deregistering an Subscriber before it has finished receiving all events (i.e. before onCompleted is called).

Annotations
@Override