package o; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /* loaded from: classes2.dex */ public final class WQG extends HiE { public TResult a; public Exception b; public boolean d; private volatile boolean e; public final Object c = new Object(); private List> j = new ArrayList(); @Override // o.HiE public final HiE a(QNe qNe) { return b(new qvr(Iwo.b(), qNe)); } @Override // o.HiE public final HiE e(LRb lRb) { return b(new C9174dej(Iwo.b(), lRb)); } @Override // o.HiE public final HiE e(IHX 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> 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 b(nRk nrk) { boolean h; synchronized (this.c) { h = h(); if (!h) { this.j.add(nrk); } } if (h) { nrk.b(this); } return this; } }