mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 02:17:18 +01:00
59 lines
2.5 KiB
Java
59 lines
2.5 KiB
Java
package io.reactivex.rxjava3.internal.util;
|
|
|
|
import io.reactivex.rxjava3.core.Observer;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import org.reactivestreams.Subscriber;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes10.dex */
|
|
public final class HalfSerializer {
|
|
private HalfSerializer() {
|
|
throw new IllegalStateException("No instances!");
|
|
}
|
|
|
|
public static void onComplete(Subscriber<?> subscriber, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
|
|
if (atomicInteger.getAndIncrement() == 0) {
|
|
atomicThrowable.tryTerminateConsumer(subscriber);
|
|
}
|
|
}
|
|
|
|
public static void onError(Subscriber<?> subscriber, Throwable th, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
|
|
if (atomicThrowable.tryAddThrowableOrReport(th) && atomicInteger.getAndIncrement() == 0) {
|
|
atomicThrowable.tryTerminateConsumer(subscriber);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static <T> boolean onNext(Subscriber<? super T> subscriber, T t, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
|
|
if (atomicInteger.get() == 0 && atomicInteger.compareAndSet(0, 1)) {
|
|
subscriber.onNext(t);
|
|
if (atomicInteger.decrementAndGet() == 0) {
|
|
return true;
|
|
}
|
|
atomicThrowable.tryTerminateConsumer(subscriber);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static void onComplete(Observer<?> observer, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
|
|
if (atomicInteger.getAndIncrement() == 0) {
|
|
atomicThrowable.tryTerminateConsumer(observer);
|
|
}
|
|
}
|
|
|
|
public static void onError(Observer<?> observer, Throwable th, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
|
|
if (atomicThrowable.tryAddThrowableOrReport(th) && atomicInteger.getAndIncrement() == 0) {
|
|
atomicThrowable.tryTerminateConsumer(observer);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static <T> void onNext(Observer<? super T> observer, T t, AtomicInteger atomicInteger, AtomicThrowable atomicThrowable) {
|
|
if (atomicInteger.get() == 0 && atomicInteger.compareAndSet(0, 1)) {
|
|
observer.onNext(t);
|
|
if (atomicInteger.decrementAndGet() != 0) {
|
|
atomicThrowable.tryTerminateConsumer(observer);
|
|
}
|
|
}
|
|
}
|
|
}
|