jimu-decompiled/sources/io/reactivex/plugins/RxJavaPlugins.java
2025-05-13 19:24:51 +02:00

238 lines
11 KiB
Java

package io.reactivex.plugins;
import io.reactivex.Completable;
import io.reactivex.CompletableObserver;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import io.reactivex.MaybeObserver;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.Scheduler;
import io.reactivex.Single;
import io.reactivex.SingleObserver;
import io.reactivex.exceptions.CompositeException;
import io.reactivex.exceptions.MissingBackpressureException;
import io.reactivex.exceptions.OnErrorNotImplementedException;
import io.reactivex.exceptions.UndeliverableException;
import io.reactivex.functions.BiFunction;
import io.reactivex.functions.BooleanSupplier;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.internal.functions.ObjectHelper;
import io.reactivex.internal.util.ExceptionHelper;
import io.reactivex.observables.ConnectableObservable;
import java.util.concurrent.Callable;
import org.reactivestreams.Subscriber;
/* loaded from: classes2.dex */
public final class RxJavaPlugins {
static volatile Consumer<? super Throwable> a;
static volatile Function<? super Runnable, ? extends Runnable> b;
static volatile Function<? super Callable<Scheduler>, ? extends Scheduler> c;
static volatile Function<? super Callable<Scheduler>, ? extends Scheduler> d;
static volatile Function<? super Callable<Scheduler>, ? extends Scheduler> e;
static volatile Function<? super Callable<Scheduler>, ? extends Scheduler> f;
static volatile Function<? super Scheduler, ? extends Scheduler> g;
static volatile Function<? super Scheduler, ? extends Scheduler> h;
static volatile Function<? super Scheduler, ? extends Scheduler> i;
static volatile Function<? super Flowable, ? extends Flowable> j;
static volatile Function<? super Observable, ? extends Observable> k;
static volatile Function<? super ConnectableObservable, ? extends ConnectableObservable> l;
static volatile Function<? super Maybe, ? extends Maybe> m;
static volatile Function<? super Single, ? extends Single> n;
static volatile Function<? super Completable, ? extends Completable> o;
static volatile BiFunction<? super Flowable, ? super Subscriber, ? extends Subscriber> p;
static volatile BiFunction<? super Maybe, ? super MaybeObserver, ? extends MaybeObserver> q;
static volatile BiFunction<? super Observable, ? super Observer, ? extends Observer> r;
static volatile BiFunction<? super Single, ? super SingleObserver, ? extends SingleObserver> s;
static volatile BiFunction<? super Completable, ? super CompletableObserver, ? extends CompletableObserver> t;
static volatile BooleanSupplier u;
static volatile boolean v;
static volatile boolean w;
public static boolean a() {
return w;
}
public static Scheduler b(Callable<Scheduler> callable) {
ObjectHelper.a(callable, "Scheduler Callable can't be null");
Function<? super Callable<Scheduler>, ? extends Scheduler> function = c;
return function == null ? a(callable) : a(function, callable);
}
public static Scheduler c(Callable<Scheduler> callable) {
ObjectHelper.a(callable, "Scheduler Callable can't be null");
Function<? super Callable<Scheduler>, ? extends Scheduler> function = e;
return function == null ? a(callable) : a(function, callable);
}
public static Scheduler d(Callable<Scheduler> callable) {
ObjectHelper.a(callable, "Scheduler Callable can't be null");
Function<? super Callable<Scheduler>, ? extends Scheduler> function = f;
return function == null ? a(callable) : a(function, callable);
}
public static Scheduler e(Callable<Scheduler> callable) {
ObjectHelper.a(callable, "Scheduler Callable can't be null");
Function<? super Callable<Scheduler>, ? extends Scheduler> function = d;
return function == null ? a(callable) : a(function, callable);
}
public static Scheduler a(Scheduler scheduler) {
Function<? super Scheduler, ? extends Scheduler> function = g;
return function == null ? scheduler : (Scheduler) a((Function<Scheduler, R>) function, scheduler);
}
static boolean a(Throwable th) {
return (th instanceof OnErrorNotImplementedException) || (th instanceof MissingBackpressureException) || (th instanceof IllegalStateException) || (th instanceof NullPointerException) || (th instanceof IllegalArgumentException) || (th instanceof CompositeException);
}
public static void b(Throwable th) {
Consumer<? super Throwable> consumer = a;
if (th == null) {
th = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources.");
} else if (!a(th)) {
th = new UndeliverableException(th);
}
if (consumer != null) {
try {
consumer.accept(th);
return;
} catch (Throwable th2) {
th2.printStackTrace();
c(th2);
}
}
th.printStackTrace();
c(th);
}
static void c(Throwable th) {
Thread currentThread = Thread.currentThread();
currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, th);
}
public static Scheduler c(Scheduler scheduler) {
Function<? super Scheduler, ? extends Scheduler> function = i;
return function == null ? scheduler : (Scheduler) a((Function<Scheduler, R>) function, scheduler);
}
public static Runnable a(Runnable runnable) {
ObjectHelper.a(runnable, "run is null");
Function<? super Runnable, ? extends Runnable> function = b;
return function == null ? runnable : (Runnable) a((Function<Runnable, R>) function, runnable);
}
public static void a(Consumer<? super Throwable> consumer) {
if (!v) {
a = consumer;
return;
}
throw new IllegalStateException("Plugins can't be changed anymore");
}
public static Scheduler b(Scheduler scheduler) {
Function<? super Scheduler, ? extends Scheduler> function = h;
return function == null ? scheduler : (Scheduler) a((Function<Scheduler, R>) function, scheduler);
}
public static <T> Subscriber<? super T> a(Flowable<T> flowable, Subscriber<? super T> subscriber) {
BiFunction<? super Flowable, ? super Subscriber, ? extends Subscriber> biFunction = p;
return biFunction != null ? (Subscriber) a(biFunction, flowable, subscriber) : subscriber;
}
public static boolean b() {
BooleanSupplier booleanSupplier = u;
if (booleanSupplier == null) {
return false;
}
try {
return booleanSupplier.a();
} catch (Throwable th) {
throw ExceptionHelper.a(th);
}
}
public static <T> Observer<? super T> a(Observable<T> observable, Observer<? super T> observer) {
BiFunction<? super Observable, ? super Observer, ? extends Observer> biFunction = r;
return biFunction != null ? (Observer) a(biFunction, observable, observer) : observer;
}
public static <T> SingleObserver<? super T> a(Single<T> single, SingleObserver<? super T> singleObserver) {
BiFunction<? super Single, ? super SingleObserver, ? extends SingleObserver> biFunction = s;
return biFunction != null ? (SingleObserver) a(biFunction, single, singleObserver) : singleObserver;
}
public static CompletableObserver a(Completable completable, CompletableObserver completableObserver) {
BiFunction<? super Completable, ? super CompletableObserver, ? extends CompletableObserver> biFunction = t;
return biFunction != null ? (CompletableObserver) a(biFunction, completable, completableObserver) : completableObserver;
}
public static <T> MaybeObserver<? super T> a(Maybe<T> maybe, MaybeObserver<? super T> maybeObserver) {
BiFunction<? super Maybe, ? super MaybeObserver, ? extends MaybeObserver> biFunction = q;
return biFunction != null ? (MaybeObserver) a(biFunction, maybe, maybeObserver) : maybeObserver;
}
public static <T> Maybe<T> a(Maybe<T> maybe) {
Function<? super Maybe, ? extends Maybe> function = m;
return function != null ? (Maybe) a((Function<Maybe<T>, R>) function, maybe) : maybe;
}
public static <T> Flowable<T> a(Flowable<T> flowable) {
Function<? super Flowable, ? extends Flowable> function = j;
return function != null ? (Flowable) a((Function<Flowable<T>, R>) function, flowable) : flowable;
}
public static <T> Observable<T> a(Observable<T> observable) {
Function<? super Observable, ? extends Observable> function = k;
return function != null ? (Observable) a((Function<Observable<T>, R>) function, observable) : observable;
}
public static <T> ConnectableObservable<T> a(ConnectableObservable<T> connectableObservable) {
Function<? super ConnectableObservable, ? extends ConnectableObservable> function = l;
return function != null ? (ConnectableObservable) a((Function<ConnectableObservable<T>, R>) function, connectableObservable) : connectableObservable;
}
public static <T> Single<T> a(Single<T> single) {
Function<? super Single, ? extends Single> function = n;
return function != null ? (Single) a((Function<Single<T>, R>) function, single) : single;
}
public static Completable a(Completable completable) {
Function<? super Completable, ? extends Completable> function = o;
return function != null ? (Completable) a((Function<Completable, R>) function, completable) : completable;
}
static <T, R> R a(Function<T, R> function, T t2) {
try {
return function.apply(t2);
} catch (Throwable th) {
throw ExceptionHelper.a(th);
}
}
static <T, U, R> R a(BiFunction<T, U, R> biFunction, T t2, U u2) {
try {
return biFunction.apply(t2, u2);
} catch (Throwable th) {
throw ExceptionHelper.a(th);
}
}
static Scheduler a(Callable<Scheduler> callable) {
try {
Scheduler call = callable.call();
ObjectHelper.a(call, "Scheduler Callable result can't be null");
return call;
} catch (Throwable th) {
throw ExceptionHelper.a(th);
}
}
static Scheduler a(Function<? super Callable<Scheduler>, ? extends Scheduler> function, Callable<Scheduler> callable) {
Object a2 = a((Function<Callable<Scheduler>, Object>) function, callable);
ObjectHelper.a(a2, "Scheduler Callable result can't be null");
return (Scheduler) a2;
}
}