@Override public void onNext(T t) { if (!checkSubscriptionOnce) { checkSubscriptionOnce = true; if (upstream.get() == null) { errors.add(new IllegalStateException("onSubscribe not called in proper order")); } } lastThread = Thread.currentThread(); if (establishedFusionMode == QueueSubscription.ASYNC) { try { while ((t = qs.poll()) != null) { values.add(t); } } catch (Throwable ex) { // Exceptions.throwIfFatal(e); TODO add fatal exceptions? errors.add(ex); qs.cancel(); } return; } values.add(t); if (t == null) { errors.add(new NullPointerException("onNext received a null value")); } downstream.onNext(t); }
@Override public void onNext(T t) { if (!checkSubscriptionOnce) { checkSubscriptionOnce = true; if (subscription.get() == null) { errors.add(new IllegalStateException("onSubscribe not called in proper order")); } } lastThread = Thread.currentThread(); if (establishedFusionMode == QueueSubscription.ASYNC) { try { while ((t = qs.poll()) != null) { values.add(t); } } catch (Throwable ex) { // Exceptions.throwIfFatal(e); TODO add fatal exceptions? errors.add(ex); qs.cancel(); } return; } values.add(t); if (t == null) { errors.add(new NullPointerException("onNext received a null value")); } actual.onNext(t); }
@Override public void onNext(Integer value) { assertFalse(qs.isEmpty()); qs.clear(); assertTrue(qs.isEmpty()); qs.cancel(); }
@Override public void onSubscribe(Subscription s) { @SuppressWarnings("unchecked") QueueSubscription<Integer> qs = (QueueSubscription<Integer>)s; qs.requestFusion(QueueFuseable.ANY); assertFalse(qs.isEmpty()); try { assertEquals(1, qs.poll().intValue()); } catch (Throwable ex) { throw new RuntimeException(ex); } assertFalse(qs.isEmpty()); qs.clear(); assertTrue(qs.isEmpty()); qs.cancel(); }
@Override public void onSubscribe(Subscription s) { @SuppressWarnings("unchecked") QueueSubscription<Integer> qs = (QueueSubscription<Integer>)s; qs.requestFusion(QueueFuseable.ANY); assertFalse(qs.isEmpty()); try { assertEquals(1, qs.poll().intValue()); } catch (Throwable ex) { throw new RuntimeException(ex); } assertFalse(qs.isEmpty()); qs.clear(); assertTrue(qs.isEmpty()); qs.cancel(); }
publish = queueSubscription.poll(); } catch (final Throwable e) { queueSubscription.cancel(); pollState.set(STATE_DONE); if (state.getAndSet(STATE_DONE) != STATE_DONE) {