public BreakerSwitchSubscriber(Subscriber<T> actual, Observable<Void> onCompleteFuture) { super(actual); this.actual = actual; onCompleteFuture.subscribe(new Subscriber<Void>() { @Override public void onCompleted() { BreakerSwitchSubscriber.this.unsubscribe(); BreakerSwitchSubscriber.this.onCompleted(); } @Override public void onError(Throwable e) { } @Override public void onNext(Void aVoid) { } }); }
Subscriber<T> subscriber = new Subscriber<T>() {
public void call() { final Thread t = Thread.currentThread(); o.unsafeSubscribe(new Subscriber<T>(subscriber) {
@Override public void onNext(Long aLong) { if (missingHeartbeatsCount.incrementAndGet() > tolerance) { logger.warn("More than {} heartbeat messages missed; closing the connection {}", tolerance, delegate.name()); shutdown(MISSING_HEARTBEAT_EXCEPTION); } else { logger.debug("Sending heartbeat message in the connection {}", delegate.name()); submit(Heartbeat.INSTANCE).subscribe(new Subscriber<Void>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { logger.warn("Failed to send heartbeat message; terminating the connection " + delegate.name(), e); shutdown(e); } @Override public void onNext(Void aVoid) { } }); } } }
@Override public void onNext(final GroupedObservable<K1, GroupedObservable<K2, T>> k1Group) { groups.startK1Group(state, k1Group.getKey()); k1Group.unsafeSubscribe(new Subscriber<GroupedObservable<K2, T>>(this) { k2Group.unsafeSubscribe(new Subscriber<T>(this) {
@Override public Subscriber<? super T> call(final Subscriber<? super ResponseHolder<T>> child) { return new Subscriber<T>() {
Subscriber<T> itemSub = new Subscriber<T>() { boolean once = true; @Override
@Override public Subscriber<? super T> call(final Subscriber<? super ResponseHolder<T>> child) { return new Subscriber<T>() {
@Override public void onNext(final GroupedObservable<K2, T> k2Group) { /* * In this scope once pivoted, k2 == outer and k2.k1 == inner */ final Inner<K1, K2, T> inner = groups.getOrCreateFor(state, child, k1Group.getKey(), k2Group.getKey()); if (inner == null) { // we have been unsubscribed return; } k2Group.unsafeSubscribe(new Subscriber<T>(this) { @Override public void onCompleted() { /* * we don't actually propagate onCompleted to the 'inner.subscriber' here * since multiple upstream groups will be sent to a single downstream * and a single upstream group completing does not indicate total completion */ } @Override public void onError(Throwable e) { inner.subscriber.onError(e); } @Override public void onNext(T t) { inner.subscriber.onNext(t); } }); }
_group.unsafeSubscribe(new Subscriber<T>(o) {
ep.disconnect().subscribe(new Subscriber<LifecycleState>() { @Override public void onCompleted() { /* ignored on purpose */ }
ep.disconnect().subscribe(new Subscriber<LifecycleState>() { @Override public void onCompleted() { /* ignored on purpose */ }
@Override public void onNext(String s) { assertEquals("msg1", s); unsubscribe(); assertFalse(consumer.isRegistered()); obs.subscribe(new Subscriber<String>() { @Override public void onNext(String s) { assertEquals("msg2", s); unsubscribe(); assertFalse(consumer.isRegistered()); testComplete(); } @Override public void onError(Throwable throwable) { fail("Was not esxpecting error " + throwable.getMessage()); } @Override public void onCompleted() { fail(); } }); eb.send("the-address", "msg2"); }
Subscriber<U> debounceSubscriber = new Subscriber<U>() {
@Override public void onError(Throwable e) { try { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); Observable<? extends T> resume = resumeFunction.call(OnErrorThrowable.from(e)); resume.unsafeSubscribe(new Subscriber<T>() { @Override public void onCompleted() { // ignore as we will continue the parent Observable } @Override public void onError(Throwable e) { // if the splice also fails we shut it all down child.onError(e); } @Override public void onNext(T t) { child.onNext(t); } }); } catch (Throwable e2) { child.onError(e2); } }
Subscriber<D> durationSub = new Subscriber<D>() { boolean once = true; @Override