@Override public void onComplete() { for (CacheSubscription inner : subscribers.getAndSet(TERMINATED)) { if (inner.get() == 0) { inner.downstream.onComplete(); } } }
@Override protected void subscribeActual(Subscriber<? super Void> s) { CacheSubscription inner = new CacheSubscription(s); s.onSubscribe(inner); if (add(inner)) { if (inner.get() != 0) { remove(inner); } if (once.compareAndSet(false, true)) { source.subscribe(this); } } else { if (inner.get() == 0) { Throwable ex = error; if (ex != null) { inner.downstream.onError(ex); } else { inner.downstream.onComplete(); } } } }
@Override protected void subscribeActual(Subscriber<? super Void> s) { CacheSubscription inner = new CacheSubscription(s); s.onSubscribe(inner); if (add(inner)) { if (inner.get() != 0) { remove(inner); } if (once.compareAndSet(false, true)) { source.subscribe(this); } } else { if (inner.get() == 0) { Throwable ex = error; if (ex != null) { inner.downstream.onError(ex); } else { inner.downstream.onComplete(); } } } }
@Override public void onComplete() { for (CacheSubscription inner : subscribers.getAndSet(TERMINATED)) { if (inner.get() == 0) { inner.downstream.onComplete(); } } }
@Override public void onError(Throwable t) { error = t; for (CacheSubscription inner : subscribers.getAndSet(TERMINATED)) { if (inner.get() == 0) { inner.downstream.onError(t); } } }
@Override public void cancel() { if (compareAndSet(0, 1)) { remove(this); } } }
@Override public void onError(Throwable t) { error = t; for (CacheSubscription inner : subscribers.getAndSet(TERMINATED)) { if (inner.get() == 0) { inner.downstream.onError(t); } } }
@Override public void cancel() { if (compareAndSet(0, 1)) { remove(this); } } }