package j0.l.e; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicReference; import rx.exceptions.CompositeException; /* compiled from: ExceptionsUtils */ public enum d { ; public static final Throwable i = new Throwable("Terminated"); public static boolean f(AtomicReference atomicReference, Throwable th) { Throwable th2; Throwable th3; do { th2 = atomicReference.get(); if (th2 == i) { return false; } if (th2 == null) { th3 = th; } else if (th2 instanceof CompositeException) { ArrayList arrayList = new ArrayList(((CompositeException) th2).b()); arrayList.add(th); th3 = new CompositeException(arrayList); } else { th3 = new CompositeException(th2, th); } } while (!atomicReference.compareAndSet(th2, th3)); return true; } public static boolean g(Throwable th) { return th == i; } public static Throwable h(AtomicReference atomicReference) { Throwable th = atomicReference.get(); Throwable th2 = i; return th != th2 ? atomicReference.getAndSet(th2) : th; } }