119 lines
2.6 KiB
Java
119 lines
2.6 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class WQG<TResult> extends HiE<TResult> {
|
||
|
public TResult a;
|
||
|
public Exception b;
|
||
|
public boolean d;
|
||
|
private volatile boolean e;
|
||
|
public final Object c = new Object();
|
||
|
private List<nRk<TResult>> j = new ArrayList();
|
||
|
|
||
|
@Override // o.HiE
|
||
|
public final HiE<TResult> a(QNe<TResult> qNe) {
|
||
|
return b(new qvr(Iwo.b(), qNe));
|
||
|
}
|
||
|
|
||
|
@Override // o.HiE
|
||
|
public final HiE<TResult> e(LRb lRb) {
|
||
|
return b(new C9174dej(Iwo.b(), lRb));
|
||
|
}
|
||
|
|
||
|
@Override // o.HiE
|
||
|
public final HiE<TResult> e(IHX<TResult> ihx) {
|
||
|
return b(new C14845gYs(Iwo.b(), ihx));
|
||
|
}
|
||
|
|
||
|
@Override // o.HiE
|
||
|
public final boolean b() {
|
||
|
boolean z;
|
||
|
synchronized (this.c) {
|
||
|
if (this.d && !this.e) {
|
||
|
z = this.b == null;
|
||
|
}
|
||
|
}
|
||
|
return z;
|
||
|
}
|
||
|
|
||
|
private boolean h() {
|
||
|
boolean z;
|
||
|
synchronized (this.c) {
|
||
|
z = this.d;
|
||
|
}
|
||
|
return z;
|
||
|
}
|
||
|
|
||
|
@Override // o.HiE
|
||
|
public final boolean d() {
|
||
|
return this.e;
|
||
|
}
|
||
|
|
||
|
@Override // o.HiE
|
||
|
public final TResult c() {
|
||
|
TResult tresult;
|
||
|
synchronized (this.c) {
|
||
|
if (this.b != null) {
|
||
|
throw new RuntimeException(this.b);
|
||
|
}
|
||
|
tresult = this.a;
|
||
|
}
|
||
|
return tresult;
|
||
|
}
|
||
|
|
||
|
@Override // o.HiE
|
||
|
public final Exception e() {
|
||
|
Exception exc;
|
||
|
synchronized (this.c) {
|
||
|
exc = this.b;
|
||
|
}
|
||
|
return exc;
|
||
|
}
|
||
|
|
||
|
public final boolean f() {
|
||
|
synchronized (this.c) {
|
||
|
if (this.d) {
|
||
|
return false;
|
||
|
}
|
||
|
this.d = true;
|
||
|
this.e = true;
|
||
|
this.c.notifyAll();
|
||
|
a();
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void a() {
|
||
|
synchronized (this.c) {
|
||
|
Iterator<nRk<TResult>> it = this.j.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
try {
|
||
|
it.next().b(this);
|
||
|
} catch (RuntimeException e) {
|
||
|
throw e;
|
||
|
} catch (Exception e2) {
|
||
|
throw new RuntimeException(e2);
|
||
|
}
|
||
|
}
|
||
|
this.j = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private HiE<TResult> b(nRk<TResult> nrk) {
|
||
|
boolean h;
|
||
|
synchronized (this.c) {
|
||
|
h = h();
|
||
|
if (!h) {
|
||
|
this.j.add(nrk);
|
||
|
}
|
||
|
}
|
||
|
if (h) {
|
||
|
nrk.b(this);
|
||
|
}
|
||
|
return this;
|
||
|
}
|
||
|
}
|