what-the-bank/sources/o/C13404fZg.java

133 lines
3.8 KiB
Java

package o;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: o.fZg, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public class C13404fZg<T> extends AbstractC13402fZe<T, C13404fZg<T>> implements InterfaceC13174fSv<T>, fSJ, InterfaceC13161fSi<T>, InterfaceC13176fSx<T>, InterfaceC13154fSb {
private final InterfaceC13174fSv<? super T> h;
private final AtomicReference<fSJ> i;
/* renamed from: o.fZg$IeS */
/* loaded from: classes6.dex */
enum IeS implements InterfaceC13174fSv<Object> {
INSTANCE;
@Override // o.InterfaceC13174fSv
public final void onComplete() {
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
}
@Override // o.InterfaceC13174fSv
public final void onNext(Object obj) {
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
}
}
public C13404fZg() {
this(IeS.INSTANCE);
}
private C13404fZg(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
this.i = new AtomicReference<>();
this.h = interfaceC13174fSv;
}
@Override // o.InterfaceC13174fSv
public void onSubscribe(fSJ fsj) {
this.b = Thread.currentThread();
if (fsj == null) {
this.d.add(new NullPointerException("onSubscribe received a null Subscription"));
return;
}
AtomicReference<fSJ> atomicReference = this.i;
while (!atomicReference.compareAndSet(null, fsj)) {
if (atomicReference.get() != null) {
fsj.dispose();
if (this.i.get() != EnumC13192fTf.DISPOSED) {
this.d.add(new IllegalStateException("onSubscribe received multiple subscriptions: ".concat(String.valueOf(fsj))));
return;
}
return;
}
}
this.h.onSubscribe(fsj);
}
@Override // o.InterfaceC13174fSv
public void onNext(T t) {
if (!this.c) {
this.c = true;
if (this.i.get() == null) {
this.d.add(new IllegalStateException("onSubscribe not called in proper order"));
}
}
this.b = Thread.currentThread();
this.f.add(t);
if (t == null) {
this.d.add(new NullPointerException("onNext received a null value"));
}
this.h.onNext(t);
}
@Override // o.InterfaceC13174fSv
public void onError(Throwable th) {
if (!this.c) {
this.c = true;
if (this.i.get() == null) {
this.d.add(new IllegalStateException("onSubscribe not called in proper order"));
}
}
try {
this.b = Thread.currentThread();
if (th == null) {
this.d.add(new NullPointerException("onError received a null Throwable"));
} else {
this.d.add(th);
}
this.h.onError(th);
} finally {
this.a.countDown();
}
}
@Override // o.InterfaceC13174fSv
public void onComplete() {
if (!this.c) {
this.c = true;
if (this.i.get() == null) {
this.d.add(new IllegalStateException("onSubscribe not called in proper order"));
}
}
try {
this.b = Thread.currentThread();
this.e++;
this.h.onComplete();
} finally {
this.a.countDown();
}
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this.i);
}
@Override // o.fSJ
public final boolean isDisposed() {
return EnumC13192fTf.c(this.i.get());
}
@Override // o.InterfaceC13161fSi
public final void e(T t) {
onNext(t);
onComplete();
}
}