@Test public void cancelUpfront() { final BlockingFirstSubscriber<Integer> bf = new BlockingFirstSubscriber<Integer>(); final AtomicBoolean b = new AtomicBoolean(); bf.cancelled = true; Subscription s = new Subscription() { @Override public void request(long n) { b.set(true); } @Override public void cancel() { } }; bf.onSubscribe(s); assertFalse(b.get()); }
@Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.setOnce(this, s)) { queue.offer(NotificationLite.subscription(this)); } }
BlockingSubscriber extends AtomicReference<Subscription> implements FlowableSubscriber<T>, Subscription { @Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.setOnce(this, s)) { queue.offer(NotificationLite.subscription(this)); } } }
BlockingSubscriber extends AtomicReference<Subscription> implements FlowableSubscriber<T>, Subscription { @Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.setOnce(this, s)) { queue.offer(NotificationLite.subscription(this)); } } BlockingSubscriber(Queue<Object> queue); }
BlockingSubscriber extends AtomicReference<Subscription> implements FlowableSubscriber<T>, Subscription { @Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.setOnce(this, s)) { queue.offer(NotificationLite.subscription(this)); } } BlockingSubscriber(Queue<Object> queue); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void request(long n); @Override void cancel(); boolean isCancelled(); }
BlockingSubscriber extends AtomicReference<Subscription> implements FlowableSubscriber<T>, Subscription { @Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.setOnce(this, s)) { queue.offer(NotificationLite.subscription(this)); } } BlockingSubscriber(Queue<Object> queue); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void request(long n); @Override void cancel(); boolean isCancelled(); static final Object TERMINATED; }