public final class EndConsumerHelper extends Object
Modifier and Type | Method and Description |
---|---|
static String |
composeMessage(String consumer)
Builds the error message with the consumer class.
|
static void |
reportDoubleSubscription(Class<?> consumer)
Report a ProtocolViolationException with a personalized message referencing
the simple type name of the consumer class and report it via
RxJavaPlugins.onError.
|
static boolean |
setOnce(AtomicReference<Disposable> upstream,
Disposable next,
Class<?> observer)
Atomically updates the target upstream AtomicReference from null to the non-null
next Disposable, otherwise disposes next and reports a ProtocolViolationException
if the AtomicReference doesn't contain the shared disposed indicator.
|
static boolean |
setOnce(AtomicReference<org.reactivestreams.Subscription> upstream,
org.reactivestreams.Subscription next,
Class<?> subscriber)
Atomically updates the target upstream AtomicReference from null to the non-null
next Subscription, otherwise cancels next and reports a ProtocolViolationException
if the AtomicReference doesn't contain the shared cancelled indicator.
|
static boolean |
validate(Disposable upstream,
Disposable next,
Class<?> observer)
Ensures that the upstream Disposable is null and returns true, otherwise
disposes the next Disposable and if the upstream is not the shared
disposed instance, reports a ProtocolViolationException due to
multiple subscribe attempts.
|
static boolean |
validate(org.reactivestreams.Subscription upstream,
org.reactivestreams.Subscription next,
Class<?> subscriber)
Ensures that the upstream Subscription is null and returns true, otherwise
cancels the next Subscription and if the upstream is not the shared
cancelled instance, reports a ProtocolViolationException due to
multiple subscribe attempts.
|
public static boolean validate(Disposable upstream, Disposable next, Class<?> observer)
upstream
- the upstream current valuenext
- the Disposable to check for nullness and dispose if necessaryobserver
- the class of the consumer to have a personalized
error message if the upstream already contains a non-cancelled Disposable.public static boolean setOnce(AtomicReference<Disposable> upstream, Disposable next, Class<?> observer)
upstream
- the target AtomicReference to updatenext
- the Disposable to set on it atomicallyobserver
- the class of the consumer to have a personalized
error message if the upstream already contains a non-cancelled Disposable.public static boolean validate(org.reactivestreams.Subscription upstream, org.reactivestreams.Subscription next, Class<?> subscriber)
upstream
- the upstream current valuenext
- the Subscription to check for nullness and cancel if necessarysubscriber
- the class of the consumer to have a personalized
error message if the upstream already contains a non-cancelled Subscription.public static boolean setOnce(AtomicReference<org.reactivestreams.Subscription> upstream, org.reactivestreams.Subscription next, Class<?> subscriber)
upstream
- the target AtomicReference to updatenext
- the Subscription to set on it atomicallysubscriber
- the class of the consumer to have a personalized
error message if the upstream already contains a non-cancelled Subscription.public static String composeMessage(String consumer)
consumer
- the class of the consumerpublic static void reportDoubleSubscription(Class<?> consumer)
consumer
- the class of the consumerCopyright © 2019. All rights reserved.