Java Code Examples for java.util.concurrent.Flow.Subscriber#onSubscribe()
The following examples show how to use
java.util.concurrent.Flow.Subscriber#onSubscribe() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Lesson3.java From Java-Concurrency-Multithreading-in-Practice with MIT License | 4 votes |
public synchronized void subscribe(Subscriber<? super WeatherForecast> subscriber) { subscriber.onSubscribe(new OnDemandWeatherForecastSubscription(subscriber, executor)); }
Example 2
Source File: AdaptedWhiteBoxSubscriberVerificationTest.java From java-async-util with Apache License 2.0 | 4 votes |
@Override protected Subscriber<Integer> createFlowSubscriber( final WhiteboxSubscriberProbe<Integer> probe) { final Subscriber<Integer> backing = new FlowAdapter.SubscribingIterator<>(); return new Subscriber<Integer>() { @Override public void onSubscribe(final Subscription s) { backing.onSubscribe(s); probe.registerOnSubscribe(new SubscriberPuppet() { @Override public void triggerRequest(final long elements) { s.request(elements); } @Override public void signalCancel() { s.cancel(); } }); } @Override public void onNext(final Integer integer) { backing.onNext(integer); probe.registerOnNext(integer); } @Override public void onError(final Throwable throwable) { backing.onError(throwable); probe.registerOnError(throwable); } @Override public void onComplete() { backing.onComplete(); probe.registerOnComplete(); } }; }
Example 3
Source File: NumberPublisher.java From Reactive-Programming-With-Java-9 with MIT License | 4 votes |
@Override public void subscribe(Subscriber<? super Long> subscriber) { // TODO Auto-generated method stub subscriber.onSubscribe(new NumberSubscription(executor,subscriber,start_range,stop_range)); }
Example 4
Source File: NumberPublisher.java From Reactive-Programming-With-Java-9 with MIT License | 4 votes |
@Override public void subscribe(Subscriber<? super Long> subscriber) { // TODO Auto-generated method stub subscriber.onSubscribe(new NumberSubscription(executor,subscriber,start_range,stop_range)); }
Example 5
Source File: IncrementingPublisher.java From demo-java-x with MIT License | 4 votes |
@Override public void subscribe(Subscriber<? super Integer> subscriber) { Sub subscription = createNewSubscriptionFor(subscriber); registerSubscription(subscription); subscriber.onSubscribe(subscription); }
Example 6
Source File: Exec.java From enmasse with Apache License 2.0 | 4 votes |
@Override public void subscribe(Subscriber<? super String> subscriber) { subscriber.onSubscribe(null); subscribers.add(subscriber); }