@Test public void offloadSubscriptionRequestNReentrant() { Subscription offloaded = offloadSubscription(); doAnswer(invocation -> { pubSub.onNext(1); return null; }).when(subscription).request(1L); doAnswer(invocation -> { offloaded.request(2); return null; }).when(pubSub).onNext(1); offloaded.request(1); verify(executor.mock).execute(any()); assertThat("Unexpected tasks executed.", executor.executeAllTasks(), is(1)); verify(pubSub).onNext(1); verify(subscription).request(1); verify(subscription).request(2); verifyNoMoreInteractions(executor.mock); }
@Override public <T> Subscriber<? super T> offloadSubscription(final Subscriber<? super T> subscriber) { return new OffloadedSubscriptionSubscriber<>(subscriber, executor); }
TaskBasedSignalOffloader implements SignalOffloader { @Override public <T> Subscriber<? super T> offloadSubscription(final Subscriber<? super T> subscriber) { return new OffloadedSubscriptionSubscriber<>(subscriber, executor); } }
TaskBasedSignalOffloader implements SignalOffloader { @Override public <T> Subscriber<? super T> offloadSubscription(final Subscriber<? super T> subscriber) { return new OffloadedSubscriptionSubscriber<>(subscriber, executor); } TaskBasedSignalOffloader(final Executor executor);   TaskBasedSignalOffloader(final Executor executor, final int publisherSignalQueueInitialCapacity); }
TaskBasedSignalOffloader implements SignalOffloader { @Override public <T> Subscriber<? super T> offloadSubscription(final Subscriber<? super T> subscriber) { return new OffloadedSubscriptionSubscriber<>(subscriber, executor); } TaskBasedSignalOffloader(final Executor executor);   TaskBasedSignalOffloader(final Executor executor, final int publisherSignalQueueInitialCapacity); @Override Subscriber<? super T> offloadSubscriber(final Subscriber<? super T> subscriber); @Override SingleSource.Subscriber<? super T> offloadSubscriber(
            final SingleSource.Subscriber<? super T> subscriber); @Override CompletableSource.Subscriber offloadSubscriber(final CompletableSource.Subscriber subscriber); @Override Subscriber<? super T> offloadSubscription(final Subscriber<? super T> subscriber); @Override SingleSource.Subscriber<? super T> offloadCancellable(
            final SingleSource.Subscriber<? super T> subscriber); @Override CompletableSource.Subscriber offloadCancellable(final CompletableSource.Subscriber subscriber); @Override void offloadSubscribe(final Subscriber<? super T> subscriber,
                                     final Consumer<Subscriber<? super T>> handleSubscribe); @Override void offloadSubscribe(final SingleSource.Subscriber<? super T> subscriber,
                                     final Consumer<SingleSource.Subscriber<? super T>> handleSubscribe); @Override void offloadSubscribe(final CompletableSource.Subscriber subscriber,
                                 final Consumer<CompletableSource.Subscriber> handleSubscribe); @Override void offloadSignal(final T signal, final Consumer<T> signalConsumer); }
TaskBasedSignalOffloader implements SignalOffloader { @Override public <T> Subscriber<? super T> offloadSubscription(final Subscriber<? super T> subscriber) { return new OffloadedSubscriptionSubscriber<>(subscriber, executor); } TaskBasedSignalOffloader(final Executor executor);   TaskBasedSignalOffloader(final Executor executor, final int publisherSignalQueueInitialCapacity); @Override Subscriber<? super T> offloadSubscriber(final Subscriber<? super T> subscriber); @Override SingleSource.Subscriber<? super T> offloadSubscriber(
            final SingleSource.Subscriber<? super T> subscriber); @Override CompletableSource.Subscriber offloadSubscriber(final CompletableSource.Subscriber subscriber); @Override Subscriber<? super T> offloadSubscription(final Subscriber<? super T> subscriber); @Override SingleSource.Subscriber<? super T> offloadCancellable(
            final SingleSource.Subscriber<? super T> subscriber); @Override CompletableSource.Subscriber offloadCancellable(final CompletableSource.Subscriber subscriber); @Override void offloadSubscribe(final Subscriber<? super T> subscriber,
                                     final Consumer<Subscriber<? super T>> handleSubscribe); @Override void offloadSubscribe(final SingleSource.Subscriber<? super T> subscriber,
                                     final Consumer<SingleSource.Subscriber<? super T>> handleSubscribe); @Override void offloadSubscribe(final CompletableSource.Subscriber subscriber,
                                 final Consumer<CompletableSource.Subscriber> handleSubscribe); @Override void offloadSignal(final T signal, final Consumer<T> signalConsumer);  }