@Test public void onError() throws Exception { List<Throwable> errors = TestHelper.trackPluginErrors(); try { fs.onError(new TestException("One")); fs.onError(new TestException("Two")); try { fs.get(5, TimeUnit.MILLISECONDS); } catch (ExecutionException ex) { assertTrue(ex.toString(), ex.getCause() instanceof TestException); assertEquals("One", ex.getCause().getMessage()); } TestHelper.assertUndeliverable(errors, 0, TestException.class, "Two"); } finally { RxJavaPlugins.reset(); } }
@Override public void onError(Throwable t) { for (;;) { Subscription a = s.get(); if (a == this || a == SubscriptionHelper.CANCELLED) { RxJavaPlugins.onError(t); return; } error = t; if (s.compareAndSet(a, this)) { countDown(); return; } } }
FutureSubscriber extends CountDownLatch implements FlowableSubscriber<T>, Future<T>, Subscription { @Override public void onError(Throwable t) { for (;;) { Subscription a = s.get(); if (a == this || a == SubscriptionHelper.CANCELLED) { RxJavaPlugins.onError(t); return; } error = t; if (s.compareAndSet(a, this)) { countDown(); return; } } } }
FutureSubscriber extends CountDownLatch implements FlowableSubscriber<T>, Future<T>, Subscription { @Override public void onError(Throwable t) { for (;;) { Subscription a = s.get(); if (a == this || a == SubscriptionHelper.CANCELLED) { RxJavaPlugins.onError(t); return; } error = t; if (s.compareAndSet(a, this)) { countDown(); return; } } } FutureSubscriber(); }
FutureSubscriber extends CountDownLatch implements FlowableSubscriber<T>, Future<T>, Subscription { @Override public void onError(Throwable t) { for (;;) { Subscription a = s.get(); if (a == this || a == SubscriptionHelper.CANCELLED) { RxJavaPlugins.onError(t); return; } error = t; if (s.compareAndSet(a, this)) { countDown(); return; } } } FutureSubscriber(); @Override boolean cancel(boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); @Override T get(); @Override T get(long timeout, TimeUnit unit); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void cancel(); @Override void request(long n); }
FutureSubscriber extends CountDownLatch implements FlowableSubscriber<T>, Future<T>, Subscription { @Override public void onError(Throwable t) { for (;;) { Subscription a = s.get(); if (a == this || a == SubscriptionHelper.CANCELLED) { RxJavaPlugins.onError(t); return; } error = t; if (s.compareAndSet(a, this)) { countDown(); return; } } } FutureSubscriber(); @Override boolean cancel(boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); @Override T get(); @Override T get(long timeout, TimeUnit unit); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void cancel(); @Override void request(long n);  }