Comments (2)
- What happens if you run the following code?
Observable.empty().repeat().subscribe();
[ ] Nothing, completes normally
[ ] Throws MissingBackpressureException
[ ] Throws OnErrorNotImplementedException
[X] Goes into an infinite loop
The operator repeat resubscribes to the source when it completes. In this case, the empty()
completes immediately, gets resubscribed and completes immediately again, ad infinitum.
Note that the same thing can happen with terminated subjects such as PublishSubject
and BehaviorSubject
or an empty ReplaySubject
!
Takeaway: never repeat a source indefinitely, especially from an unknown source.
from reactive-streams-commons.
- What happens when you run the following code?
PublishSubject<Integer> ps = PublishSubject.create();
ps.subscribeOn(Schedulers.computation()).subscribe(v -> System.out.println(Thread.currentThread.getName()));
Thread.sleep(1000);
ps.onNext(1);
[X] Prints main
[ ] Prints 1
[ ] Prints RxComputationScheduler-1
[ ] Throws an Exception
The operator subscribeOn
has no effect on a running PublishSubject
because it doesn't have any visible subscription side-effects. However the other subjects may signal a value or completion on the given Scheduler.
from reactive-streams-commons.
Related Issues (20)
- Expand Macro-Fusion paths
- Expand Micro-Fusion ( Back-Fusion and ConditionalSubscriber )
- Add PatitionPublisher and PublisherPartition
- Review and Mark Unbounded Operators
- Add IndexedQueue contract to optimize draining paths
- Explore timed microbatch operators
- Explore Backpressurable#getCapacity optimizations
- Make GroupBy and future partitioning operator store-agnostic HOT 3
- Use shaded dependency on JCTools instead of copy and paste HOT 7
- Unbounded FlatMap with slow consumer HOT 1
- 101 Reactive Gems (working title) HOT 22
- Gem 22) discussion HOT 5
- Question: Using Reactor streams HOT 3
- Fusing subscribeOn with upstream HOT 8
- Clarification on the Scheduler.Worker.schedule contract HOT 3
- Throttling on leading and trailing edge HOT 11
- Add PublisherIndexOf
- Add PublisherEvery HOT 1
- Expand Micro-Fusion (Front Fusion)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactive-streams-commons.