package o; import io.reactivex.rxjava3.exceptions.CompositeException; import java.util.concurrent.atomic.AtomicReference; /* loaded from: classes6.dex */ public final class fTY extends AtomicReference implements InterfaceC13174fSv, fSJ { private fSQ b; private fSQ c; private fSP d; private fSQ e; public fTY(fSQ fsq, fSQ fsq2, fSP fsp, fSQ fsq3) { this.e = fsq; this.b = fsq2; this.d = fsp; this.c = fsq3; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { if (EnumC13192fTf.a(this, fsj)) { try { this.c.c(this); } catch (Throwable th) { C13147fSI.c(th); fsj.dispose(); onError(th); } } } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (isDisposed()) { return; } try { this.e.c(t); } catch (Throwable th) { C13147fSI.c(th); get().dispose(); onError(th); } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { if (!isDisposed()) { lazySet(EnumC13192fTf.DISPOSED); try { this.b.c(th); return; } catch (Throwable th2) { C13147fSI.c(th2); C13418fZu.c(new CompositeException(th, th2)); return; } } C13418fZu.c(th); } @Override // o.InterfaceC13174fSv public final void onComplete() { if (isDisposed()) { return; } lazySet(EnumC13192fTf.DISPOSED); try { this.d.c(); } catch (Throwable th) { C13147fSI.c(th); C13418fZu.c(th); } } @Override // o.fSJ public final void dispose() { EnumC13192fTf.e(this); } @Override // o.fSJ public final boolean isDisposed() { return get() == EnumC13192fTf.DISPOSED; } }