59 lines
1.9 KiB
Java
59 lines
1.9 KiB
Java
package io.reactivex.android.plugins;
|
|
|
|
import io.reactivex.Scheduler;
|
|
import io.reactivex.exceptions.Exceptions;
|
|
import io.reactivex.functions.Function;
|
|
import java.util.concurrent.Callable;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class RxAndroidPlugins {
|
|
private static volatile Function<Callable<Scheduler>, Scheduler> a;
|
|
private static volatile Function<Scheduler, Scheduler> b;
|
|
|
|
public static Scheduler a(Scheduler scheduler) {
|
|
if (scheduler == null) {
|
|
throw new NullPointerException("scheduler == null");
|
|
}
|
|
Function<Scheduler, Scheduler> function = b;
|
|
return function == null ? scheduler : (Scheduler) a((Function<Scheduler, R>) function, scheduler);
|
|
}
|
|
|
|
public static Scheduler b(Callable<Scheduler> callable) {
|
|
if (callable == null) {
|
|
throw new NullPointerException("scheduler == null");
|
|
}
|
|
Function<Callable<Scheduler>, Scheduler> function = a;
|
|
return function == null ? a(callable) : a(function, callable);
|
|
}
|
|
|
|
static Scheduler a(Callable<Scheduler> callable) {
|
|
try {
|
|
Scheduler call = callable.call();
|
|
if (call != null) {
|
|
return call;
|
|
}
|
|
throw new NullPointerException("Scheduler Callable returned null");
|
|
} catch (Throwable th) {
|
|
Exceptions.a(th);
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
static Scheduler a(Function<Callable<Scheduler>, Scheduler> function, Callable<Scheduler> callable) {
|
|
Scheduler scheduler = (Scheduler) a((Function<Callable<Scheduler>, R>) function, callable);
|
|
if (scheduler != null) {
|
|
return scheduler;
|
|
}
|
|
throw new NullPointerException("Scheduler Callable returned null");
|
|
}
|
|
|
|
static <T, R> R a(Function<T, R> function, T t) {
|
|
try {
|
|
return function.apply(t);
|
|
} catch (Throwable th) {
|
|
Exceptions.a(th);
|
|
throw null;
|
|
}
|
|
}
|
|
}
|