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

165 lines
4.7 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import o.AbstractC13173fSu;
/* loaded from: classes6.dex */
public final class fVD<T> extends fUX<T, T> {
private TimeUnit a;
private AbstractC13173fSu b;
private long d;
private fSQ<? super T> e;
public fVD(InterfaceC13169fSq<T> interfaceC13169fSq, long j, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, fSQ<? super T> fsq) {
super(interfaceC13169fSq);
this.d = j;
this.a = timeUnit;
this.b = abstractC13173fSu;
this.e = fsq;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
this.c.subscribe(new IeS(new C13406fZi(interfaceC13174fSv), this.d, this.a, this.b.c(), this.e));
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public static final class IeS<T> implements InterfaceC13174fSv<T>, fSJ {
private boolean a;
private fSQ<? super T> b;
final InterfaceC13174fSv<? super T> c;
private long d;
volatile long e;
private fSJ g;
private AbstractC13173fSu.Sts h;
private TimeUnit i;
private HBt<T> j;
IeS(InterfaceC13174fSv<? super T> interfaceC13174fSv, long j, TimeUnit timeUnit, AbstractC13173fSu.Sts sts, fSQ<? super T> fsq) {
this.c = interfaceC13174fSv;
this.d = j;
this.i = timeUnit;
this.h = sts;
this.b = fsq;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.g, fsj)) {
this.g = fsj;
this.c.onSubscribe(this);
}
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
if (this.a) {
return;
}
long j = this.e + 1;
this.e = j;
HBt<T> hBt = this.j;
if (hBt != null) {
hBt.dispose();
}
fSQ<? super T> fsq = this.b;
if (fsq != null && hBt != null) {
try {
fsq.c(this.j.b);
} catch (Throwable th) {
C13147fSI.c(th);
this.g.dispose();
this.c.onError(th);
this.a = true;
}
}
HBt<T> hBt2 = new HBt<>(t, j, this);
this.j = hBt2;
EnumC13192fTf.c(hBt2, this.h.a(hBt2, this.d, this.i));
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (this.a) {
C13418fZu.c(th);
return;
}
HBt<T> hBt = this.j;
if (hBt != null) {
hBt.dispose();
}
this.a = true;
this.c.onError(th);
this.h.dispose();
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (this.a) {
return;
}
this.a = true;
HBt<T> hBt = this.j;
if (hBt != null) {
hBt.dispose();
}
if (hBt != null) {
hBt.run();
}
this.c.onComplete();
this.h.dispose();
}
@Override // o.fSJ
public final void dispose() {
this.g.dispose();
this.h.dispose();
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.h.isDisposed();
}
}
/* loaded from: classes6.dex */
static final class HBt<T> extends AtomicReference<fSJ> implements Runnable, fSJ {
private IeS<T> a;
final T b;
private long c;
private AtomicBoolean d = new AtomicBoolean();
HBt(T t, long j, IeS<T> ieS) {
this.b = t;
this.c = j;
this.a = ieS;
}
@Override // java.lang.Runnable
public final void run() {
if (this.d.compareAndSet(false, true)) {
IeS<T> ieS = this.a;
long j = this.c;
T t = this.b;
if (j == ieS.e) {
ieS.c.onNext(t);
dispose();
}
}
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this);
}
@Override // o.fSJ
public final boolean isDisposed() {
return get() == EnumC13192fTf.DISPOSED;
}
}
}