@Override public void onNext(T t) { ObjectHelper.requireNonNull(t, "onNext called with null. Null values are generally not allowed in 2.x operators and sources."); if (done) { return; } ReplayBuffer<T> b = buffer; b.add(t); for (ReplayDisposable<T> rs : observers.get()) { b.replay(rs); } }
@Override public void onNext(T t) { ObjectHelper.requireNonNull(t, "onNext called with null. Null values are generally not allowed in 2.x operators and sources."); if (done) { return; } ReplayBuffer<T> b = buffer; b.add(t); for (ReplayDisposable<T> rs : observers.get()) { b.replay(rs); } }
@Override public void onError(Throwable t) { ObjectHelper.requireNonNull(t, "onError called with null. Null values are generally not allowed in 2.x operators and sources."); if (done) { RxJavaPlugins.onError(t); return; } done = true; Object o = NotificationLite.error(t); ReplayBuffer<T> b = buffer; b.addFinal(o); for (ReplayDisposable<T> rs : terminate(o)) { b.replay(rs); } }
@Override public void onComplete() { if (done) { return; } done = true; Object o = NotificationLite.complete(); ReplayBuffer<T> b = buffer; b.addFinal(o); for (ReplayDisposable<T> rs : terminate(o)) { b.replay(rs); } }
@Override protected void subscribeActual(Observer<? super T> observer) { ReplayDisposable<T> rs = new ReplayDisposable<T>(observer, this); observer.onSubscribe(rs); if (!rs.cancelled) { if (add(rs)) { if (rs.cancelled) { remove(rs); return; } } buffer.replay(rs); } }
@Override public void onError(Throwable t) { ObjectHelper.requireNonNull(t, "onError called with null. Null values are generally not allowed in 2.x operators and sources."); if (done) { RxJavaPlugins.onError(t); return; } done = true; Object o = NotificationLite.error(t); ReplayBuffer<T> b = buffer; b.addFinal(o); for (ReplayDisposable<T> rs : terminate(o)) { b.replay(rs); } }
@Override public void onComplete() { if (done) { return; } done = true; Object o = NotificationLite.complete(); ReplayBuffer<T> b = buffer; b.addFinal(o); for (ReplayDisposable<T> rs : terminate(o)) { b.replay(rs); } }
@Override protected void subscribeActual(Observer<? super T> observer) { ReplayDisposable<T> rs = new ReplayDisposable<T>(observer, this); observer.onSubscribe(rs); if (!rs.cancelled) { if (add(rs)) { if (rs.cancelled) { remove(rs); return; } } buffer.replay(rs); } }