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

167 lines
5.7 KiB
Java

package o;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes6.dex */
public final class fWW<T> extends fUX<T, T> {
private fSS<? super AbstractC13163fSk<Throwable>, ? extends InterfaceC13169fSq<?>> b;
public fWW(InterfaceC13169fSq<T> interfaceC13169fSq, fSS<? super AbstractC13163fSk<Throwable>, ? extends InterfaceC13169fSq<?>> fss) {
super(interfaceC13169fSq);
this.b = fss;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
C13420fZw c13420fZw = new C13420fZw(C13389fZA.d());
try {
InterfaceC13169fSq interfaceC13169fSq = (InterfaceC13169fSq) Objects.requireNonNull(this.b.a(c13420fZw), "The handler returned a null ObservableSource");
Sts sts = new Sts(interfaceC13174fSv, c13420fZw, this.c);
interfaceC13174fSv.onSubscribe(sts);
interfaceC13169fSq.subscribe(sts.e);
sts.a();
} catch (Throwable th) {
C13147fSI.c(th);
EnumC13195fTi.a(th, interfaceC13174fSv);
}
}
/* loaded from: classes6.dex */
static final class Sts<T> extends AtomicInteger implements InterfaceC13174fSv<T>, fSJ {
final InterfaceC13174fSv<? super T> a;
private volatile boolean d;
private InterfaceC13169fSq<T> h;
private AbstractC13422fZy<Throwable> i;
private AtomicInteger f = new AtomicInteger();
final C13355fYI c = new C13355fYI();
final Sts<T>.RVV e = new RVV(this);
final AtomicReference<fSJ> b = new AtomicReference<>();
Sts(InterfaceC13174fSv<? super T> interfaceC13174fSv, AbstractC13422fZy<Throwable> abstractC13422fZy, InterfaceC13169fSq<T> interfaceC13169fSq) {
this.a = interfaceC13174fSv;
this.i = abstractC13422fZy;
this.h = interfaceC13169fSq;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.c(this.b, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
fYQ.b(this.a, t, this, this.c);
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
EnumC13192fTf.c(this.b, null);
this.d = false;
this.i.onNext(th);
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
EnumC13192fTf.e(this.e);
InterfaceC13174fSv<? super T> interfaceC13174fSv = this.a;
C13355fYI c13355fYI = this.c;
if (getAndIncrement() == 0) {
Throwable b = fYR.b(c13355fYI);
if (b == null) {
interfaceC13174fSv.onComplete();
} else if (b != fYR.b) {
interfaceC13174fSv.onError(b);
}
}
}
@Override // o.fSJ
public final boolean isDisposed() {
return EnumC13192fTf.c(this.b.get());
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this.b);
EnumC13192fTf.e(this.e);
}
final void a() {
if (this.f.getAndIncrement() != 0) {
return;
}
while (!isDisposed()) {
if (!this.d) {
this.d = true;
this.h.subscribe(this);
}
if (this.f.decrementAndGet() == 0) {
return;
}
}
}
/* loaded from: classes6.dex */
final class RVV extends AtomicReference<fSJ> implements InterfaceC13174fSv<Object> {
private Sts e;
RVV(Sts sts) {
this.e = sts;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
Sts sts = this.e;
EnumC13192fTf.e(sts.b);
InterfaceC13174fSv<? super T> interfaceC13174fSv = sts.a;
C13355fYI c13355fYI = sts.c;
if (fYR.c(c13355fYI, th)) {
if (sts.getAndIncrement() == 0) {
Throwable b = fYR.b(c13355fYI);
if (b == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b != fYR.b) {
interfaceC13174fSv.onError(b);
return;
}
return;
}
}
return;
}
C13418fZu.c(th);
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
Sts sts = this.e;
EnumC13192fTf.e(sts.b);
InterfaceC13174fSv<? super T> interfaceC13174fSv = sts.a;
C13355fYI c13355fYI = sts.c;
if (sts.getAndIncrement() == 0) {
Throwable b = fYR.b(c13355fYI);
if (b == null) {
interfaceC13174fSv.onComplete();
} else if (b != fYR.b) {
interfaceC13174fSv.onError(b);
}
}
}
@Override // o.InterfaceC13174fSv
public final void onNext(Object obj) {
this.e.a();
}
}
}
}