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

258 lines
8.0 KiB
Java

package o;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import o.AbstractC13173fSu;
/* loaded from: classes6.dex */
public final class fXE<T> extends fUX<T, T> {
private long a;
private AbstractC13173fSu b;
private TimeUnit d;
private InterfaceC13169fSq<? extends T> e;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public interface Sts {
void b(long j);
}
public fXE(AbstractC13163fSk<T> abstractC13163fSk, long j, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, InterfaceC13169fSq<? extends T> interfaceC13169fSq) {
super(abstractC13163fSk);
this.a = j;
this.d = timeUnit;
this.b = abstractC13173fSu;
this.e = interfaceC13169fSq;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
if (this.e == null) {
LWm lWm = new LWm(interfaceC13174fSv, this.a, this.d, this.b.c());
interfaceC13174fSv.onSubscribe(lWm);
lWm.e(0L);
this.c.subscribe(lWm);
return;
}
RVV rvv = new RVV(interfaceC13174fSv, this.a, this.d, this.b.c(), this.e);
interfaceC13174fSv.onSubscribe(rvv);
rvv.d(0L);
this.c.subscribe(rvv);
}
/* loaded from: classes6.dex */
static final class LWm<T> extends AtomicLong implements InterfaceC13174fSv<T>, fSJ, Sts {
private TimeUnit b;
private long c;
private InterfaceC13174fSv<? super T> e;
private AbstractC13173fSu.Sts j;
private C13197fTk a = new C13197fTk();
private AtomicReference<fSJ> d = new AtomicReference<>();
LWm(InterfaceC13174fSv<? super T> interfaceC13174fSv, long j, TimeUnit timeUnit, AbstractC13173fSu.Sts sts) {
this.e = interfaceC13174fSv;
this.c = j;
this.b = timeUnit;
this.j = sts;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this.d, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
long j = get();
if (j != Long.MAX_VALUE) {
long j2 = 1 + j;
if (compareAndSet(j, j2)) {
this.a.get().dispose();
this.e.onNext(t);
e(j2);
}
}
}
final void e(long j) {
EnumC13192fTf.c(this.a, this.j.a(new IeS(j, this), this.c, this.b));
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) {
this.a.dispose();
this.e.onError(th);
this.j.dispose();
return;
}
C13418fZu.c(th);
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) {
this.a.dispose();
this.e.onComplete();
this.j.dispose();
}
}
@Override // o.fXE.Sts
public final void b(long j) {
if (compareAndSet(j, Long.MAX_VALUE)) {
EnumC13192fTf.e(this.d);
this.e.onError(new TimeoutException(fYR.a(this.c, this.b)));
this.j.dispose();
}
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this.d);
this.j.dispose();
}
@Override // o.fSJ
public final boolean isDisposed() {
return EnumC13192fTf.c(this.d.get());
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public static final class IeS implements Runnable {
private long b;
private Sts e;
IeS(long j, Sts sts) {
this.b = j;
this.e = sts;
}
@Override // java.lang.Runnable
public final void run() {
this.e.b(this.b);
}
}
/* loaded from: classes6.dex */
static final class RVV<T> extends AtomicReference<fSJ> implements InterfaceC13174fSv<T>, fSJ, Sts {
private InterfaceC13169fSq<? extends T> a;
private long b;
private InterfaceC13174fSv<? super T> d;
private TimeUnit f;
private AbstractC13173fSu.Sts j;
private C13197fTk c = new C13197fTk();
private AtomicLong e = new AtomicLong();
private AtomicReference<fSJ> h = new AtomicReference<>();
RVV(InterfaceC13174fSv<? super T> interfaceC13174fSv, long j, TimeUnit timeUnit, AbstractC13173fSu.Sts sts, InterfaceC13169fSq<? extends T> interfaceC13169fSq) {
this.d = interfaceC13174fSv;
this.b = j;
this.f = timeUnit;
this.j = sts;
this.a = interfaceC13169fSq;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this.h, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
long j = this.e.get();
if (j != Long.MAX_VALUE) {
long j2 = 1 + j;
if (this.e.compareAndSet(j, j2)) {
this.c.get().dispose();
this.d.onNext(t);
d(j2);
}
}
}
final void d(long j) {
EnumC13192fTf.c(this.c, this.j.a(new IeS(j, this), this.b, this.f));
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (this.e.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) {
this.c.dispose();
this.d.onError(th);
this.j.dispose();
return;
}
C13418fZu.c(th);
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (this.e.getAndSet(Long.MAX_VALUE) != Long.MAX_VALUE) {
this.c.dispose();
this.d.onComplete();
this.j.dispose();
}
}
@Override // o.fXE.Sts
public final void b(long j) {
if (this.e.compareAndSet(j, Long.MAX_VALUE)) {
EnumC13192fTf.e(this.h);
InterfaceC13169fSq<? extends T> interfaceC13169fSq = this.a;
this.a = null;
interfaceC13169fSq.subscribe(new HBt(this.d, this));
this.j.dispose();
}
}
@Override // o.fSJ
public final void dispose() {
EnumC13192fTf.e(this.h);
EnumC13192fTf.e(this);
this.j.dispose();
}
@Override // o.fSJ
public final boolean isDisposed() {
return EnumC13192fTf.c(get());
}
}
/* loaded from: classes6.dex */
static final class HBt<T> implements InterfaceC13174fSv<T> {
private InterfaceC13174fSv<? super T> a;
private AtomicReference<fSJ> b;
/* JADX INFO: Access modifiers changed from: package-private */
public HBt(InterfaceC13174fSv<? super T> interfaceC13174fSv, AtomicReference<fSJ> atomicReference) {
this.a = interfaceC13174fSv;
this.b = atomicReference;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.c(this.b, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
this.a.onNext(t);
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
this.a.onError(th);
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
this.a.onComplete();
}
}
}