Class SafeSubscriber<T>
java.lang.Object
io.reactivex.rxjava4.subscribers.SafeSubscriber<T>
- Type Parameters:
T- the value type
- All Implemented Interfaces:
FlowableSubscriber<T>, Flow.Subscriber<T>, Flow.Subscription
public final class SafeSubscriber<@NonNull T>
extends Object
implements FlowableSubscriber<T>, Flow.Subscription
Wraps another
Flow.Subscriber and ensures all onXXX methods conform the protocol
(except the requirement for serialized access).-
Constructor Summary
ConstructorsConstructorDescriptionSafeSubscriber(@NonNull Flow.Subscriber<? super @NonNull T> downstream) Constructs aSafeSubscriberby wrapping the given actualFlow.Subscriber. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()voidvoidvoidvoidImplementors of this method should make sure everything that needs to be visible inFlow.Subscriber.onNext(Object)is established before callingFlow.Subscription.request(long).voidrequest(long n)
-
Constructor Details
-
SafeSubscriber
Constructs aSafeSubscriberby wrapping the given actualFlow.Subscriber.- Parameters:
downstream- the actualSubscriberto wrap, notnull(not validated)
-
-
Method Details
-
onSubscribe
Description copied from interface:FlowableSubscriberImplementors of this method should make sure everything that needs to be visible inFlow.Subscriber.onNext(Object)is established before callingFlow.Subscription.request(long). In practice this means no initialization should happen after therequest()call and additional behavior is thread safe in respect toonNext.- Specified by:
onSubscribein interfaceFlow.Subscriber<T>- Specified by:
onSubscribein interfaceFlowableSubscriber<T>
-
onNext
-
onError
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceFlow.Subscriber<T>
-
request
public void request(long n) - Specified by:
requestin interfaceFlow.Subscription
-
cancel
public void cancel()- Specified by:
cancelin interfaceFlow.Subscription
-