public PublisherRepeatWhenMainSubscriber(Subscriber<? super T> actual, Subscriber<Long> signaller, Publisher<? extends T> source) { super(actual); this.signaller = signaller; this.source = source; this.otherArbiter = new DeferredSubscription(); }
void cancelWhen() { otherArbiter.cancel(); }
@Override public final boolean isTerminated() { return isCancelled(); }
void requestInner(long n) { super.request(n); }
public void setWhen(Subscription w) { otherArbiter.set(w); }
@Override public void onError(Throwable t) { long p = produced; if (p != 0L) { produced = 0; produced(p); } otherArbiter.request(1); signaller.onNext(t); }
void setWhen(Subscription w) { otherArbiter.set(w); }
void cancelWhen() { otherArbiter.cancel(); }
@Override public void onComplete() { long p = produced; if (p != 0L) { produced = 0; produced(p); } otherArbiter.request(1); signaller.onNext(p); }
public PublisherRetryWhenMainSubscriber(Subscriber<? super T> actual, Subscriber<Throwable> signaller, Publisher<? extends T> source) { super(actual); this.signaller = signaller; this.source = source; this.otherArbiter = new DeferredSubscription(); }
@Override public void onComplete() { otherArbiter.cancel(); subscriber.onComplete(); }
@Override public void run() { long r; int missed = 1; for(;;){ r = REQUESTED.getAndSet(this, 0L); if(r != 0L) { super.request(r); } if(r == Long.MAX_VALUE){ return; } missed = WIP.addAndGet(this, -missed); if(missed == 0){ break; } } }
@Override public void onError(Throwable t) { otherArbiter.cancel(); subscriber.onError(t); }
@Override public void cancel() { super.cancel(); worker.shutdown(); }
@Override public void cancel() { super.cancel(); worker.shutdown(); }