160 lines
4.9 KiB
Java
160 lines
4.9 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.concurrent.TimeUnit;
|
||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||
|
import java.util.concurrent.atomic.AtomicReference;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public final class fWX<T> extends fUX<T, T> {
|
||
|
private fSQ<? super T> a;
|
||
|
private boolean b;
|
||
|
private long d;
|
||
|
private AbstractC13173fSu e;
|
||
|
private TimeUnit i;
|
||
|
|
||
|
public fWX(InterfaceC13169fSq<T> interfaceC13169fSq, long j, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, boolean z, fSQ<? super T> fsq) {
|
||
|
super(interfaceC13169fSq);
|
||
|
this.d = j;
|
||
|
this.i = timeUnit;
|
||
|
this.e = abstractC13173fSu;
|
||
|
this.b = z;
|
||
|
this.a = fsq;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC13163fSk
|
||
|
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
|
||
|
C13406fZi c13406fZi = new C13406fZi(interfaceC13174fSv);
|
||
|
if (this.b) {
|
||
|
this.c.subscribe(new RVV(c13406fZi, this.d, this.i, this.e, this.a));
|
||
|
} else {
|
||
|
this.c.subscribe(new IeS(c13406fZi, this.d, this.i, this.e, this.a));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
static abstract class LWm<T> extends AtomicReference<T> implements InterfaceC13174fSv<T>, fSJ, Runnable {
|
||
|
private long a;
|
||
|
private fSQ<? super T> b;
|
||
|
private AtomicReference<fSJ> c = new AtomicReference<>();
|
||
|
private AbstractC13173fSu d;
|
||
|
final InterfaceC13174fSv<? super T> e;
|
||
|
private fSJ g;
|
||
|
private TimeUnit i;
|
||
|
|
||
|
abstract void e();
|
||
|
|
||
|
LWm(InterfaceC13174fSv<? super T> interfaceC13174fSv, long j, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, fSQ<? super T> fsq) {
|
||
|
this.e = interfaceC13174fSv;
|
||
|
this.a = j;
|
||
|
this.i = timeUnit;
|
||
|
this.d = abstractC13173fSu;
|
||
|
this.b = fsq;
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public void onSubscribe(fSJ fsj) {
|
||
|
if (EnumC13192fTf.d(this.g, fsj)) {
|
||
|
this.g = fsj;
|
||
|
this.e.onSubscribe(this);
|
||
|
AbstractC13173fSu abstractC13173fSu = this.d;
|
||
|
long j = this.a;
|
||
|
EnumC13192fTf.c(this.c, abstractC13173fSu.d(this, j, j, this.i));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public void onNext(T t) {
|
||
|
fSQ<? super T> fsq;
|
||
|
T andSet = getAndSet(t);
|
||
|
if (andSet == null || (fsq = this.b) == null) {
|
||
|
return;
|
||
|
}
|
||
|
try {
|
||
|
fsq.c(andSet);
|
||
|
} catch (Throwable th) {
|
||
|
C13147fSI.c(th);
|
||
|
EnumC13192fTf.e(this.c);
|
||
|
this.g.dispose();
|
||
|
this.e.onError(th);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public void onError(Throwable th) {
|
||
|
EnumC13192fTf.e(this.c);
|
||
|
this.e.onError(th);
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public void onComplete() {
|
||
|
EnumC13192fTf.e(this.c);
|
||
|
e();
|
||
|
}
|
||
|
|
||
|
@Override // o.fSJ
|
||
|
public void dispose() {
|
||
|
EnumC13192fTf.e(this.c);
|
||
|
this.g.dispose();
|
||
|
}
|
||
|
|
||
|
@Override // o.fSJ
|
||
|
public boolean isDisposed() {
|
||
|
return this.g.isDisposed();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
static final class IeS<T> extends LWm<T> {
|
||
|
IeS(InterfaceC13174fSv<? super T> interfaceC13174fSv, long j, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, fSQ<? super T> fsq) {
|
||
|
super(interfaceC13174fSv, j, timeUnit, abstractC13173fSu, fsq);
|
||
|
}
|
||
|
|
||
|
@Override // o.fWX.LWm
|
||
|
final void e() {
|
||
|
this.e.onComplete();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
T andSet = getAndSet(null);
|
||
|
if (andSet != null) {
|
||
|
this.e.onNext(andSet);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
static final class RVV<T> extends LWm<T> {
|
||
|
private AtomicInteger c;
|
||
|
|
||
|
RVV(InterfaceC13174fSv<? super T> interfaceC13174fSv, long j, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, fSQ<? super T> fsq) {
|
||
|
super(interfaceC13174fSv, j, timeUnit, abstractC13173fSu, fsq);
|
||
|
this.c = new AtomicInteger(1);
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
if (this.c.incrementAndGet() == 2) {
|
||
|
T andSet = getAndSet(null);
|
||
|
if (andSet != null) {
|
||
|
this.e.onNext(andSet);
|
||
|
}
|
||
|
if (this.c.decrementAndGet() == 0) {
|
||
|
this.e.onComplete();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.fWX.LWm
|
||
|
final void e() {
|
||
|
T andSet = getAndSet(null);
|
||
|
if (andSet != null) {
|
||
|
this.e.onNext(andSet);
|
||
|
}
|
||
|
if (this.c.decrementAndGet() == 0) {
|
||
|
this.e.onComplete();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|