package j0.l.a; import j0.f; import java.util.concurrent.atomic.AtomicLong; import rx.Producer; import rx.Subscriber; import rx.functions.Action0; import rx.subjects.Subject; import rx.subscriptions.SerialSubscription; /* compiled from: OnSubscribeRedo */ public class t implements Action0 { public final /* synthetic */ Subscriber i; public final /* synthetic */ Subject j; public final /* synthetic */ j0.l.b.a k; public final /* synthetic */ AtomicLong l; public final /* synthetic */ SerialSubscription m; public final /* synthetic */ y n; /* compiled from: OnSubscribeRedo */ public class a extends Subscriber { public boolean i; public a() { } @Override // j0.g public void onCompleted() { if (!this.i) { this.i = true; unsubscribe(); t.this.j.onNext(f.a); } } @Override // j0.g public void onError(Throwable th) { if (!this.i) { this.i = true; unsubscribe(); t.this.j.onNext(new f(f.a.OnError, null, th)); } } @Override // j0.g public void onNext(T t) { long j; if (!this.i) { t.this.i.onNext(t); do { j = t.this.l.get(); if (j == Long.MAX_VALUE) { break; } } while (!t.this.l.compareAndSet(j, j - 1)); t.this.k.b(1); } } @Override // rx.Subscriber public void setProducer(Producer producer) { t.this.k.c(producer); } } public t(y yVar, Subscriber subscriber, Subject subject, j0.l.b.a aVar, AtomicLong atomicLong, SerialSubscription serialSubscription) { this.n = yVar; this.i = subscriber; this.j = subject; this.k = aVar; this.l = atomicLong; this.m = serialSubscription; } @Override // rx.functions.Action0 public void call() { if (!this.i.isUnsubscribed()) { a aVar = new a(); this.m.a(aVar); this.n.i.i0(aVar); } } }