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

148 lines
4.1 KiB
Java

package o;
/* renamed from: o.fZi, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13406fZi<T> implements InterfaceC13174fSv<T>, fSJ {
private boolean a;
private InterfaceC13174fSv<? super T> b;
private volatile boolean c;
private fYL<Object> d;
private boolean e;
private fSJ g;
public C13406fZi(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
this(interfaceC13174fSv, (byte) 0);
}
private C13406fZi(InterfaceC13174fSv<? super T> interfaceC13174fSv, byte b) {
this.b = interfaceC13174fSv;
this.a = false;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.g, fsj)) {
this.g = fsj;
this.b.onSubscribe(this);
}
}
@Override // o.fSJ
public final void dispose() {
this.c = true;
this.g.dispose();
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.g.isDisposed();
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
if (this.c) {
return;
}
if (t == null) {
this.g.dispose();
onError(fYR.c("onNext called with a null value."));
return;
}
synchronized (this) {
if (this.c) {
return;
}
if (this.e) {
fYL<Object> fyl = this.d;
if (fyl == null) {
fyl = new fYL<>();
this.d = fyl;
}
fyl.d(fYX.d(t));
return;
}
this.e = true;
this.b.onNext(t);
while (true) {
synchronized (this) {
fYL<Object> fyl2 = this.d;
if (fyl2 == null) {
this.e = false;
return;
}
this.d = null;
InterfaceC13174fSv<? super T> interfaceC13174fSv = this.b;
int i = fyl2.e;
for (Object[] objArr = fyl2.c; objArr != null; objArr = objArr[i]) {
for (int i2 = 0; i2 < i; i2++) {
Object[] objArr2 = objArr[i2];
if (objArr2 == null) {
break;
} else {
if (fYX.d(objArr2, interfaceC13174fSv)) {
return;
}
}
}
}
}
}
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (this.c) {
C13418fZu.c(th);
return;
}
synchronized (this) {
boolean z = true;
if (!this.c) {
if (this.e) {
this.c = true;
fYL<Object> fyl = this.d;
if (fyl == null) {
fyl = new fYL<>();
this.d = fyl;
}
fyl.c[0] = fYX.a(th);
return;
}
this.c = true;
this.e = true;
z = false;
}
if (z) {
C13418fZu.c(th);
} else {
this.b.onError(th);
}
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (this.c) {
return;
}
synchronized (this) {
if (this.c) {
return;
}
if (this.e) {
fYL<Object> fyl = this.d;
if (fyl == null) {
fyl = new fYL<>();
this.d = fyl;
}
fyl.d(fYX.c());
return;
}
this.c = true;
this.e = true;
this.b.onComplete();
}
}
}