-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should Observable.range and Observable.from be in BlockingObservable? #291
Comments
That would be wrong. Moreover encoding this in the return type is totally useless since after you compose it with another operator that knowledge is lost. Encoding properties of an observable in the return type just does not work. My guess us that it is probably ok to always use newthreadscheduler as the default, for .net we had long discussions on what to use as the defaults but never measured. Sent from my iPhone On Jun 6, 2013, at 3:11 AM, Gerben notifications@github.com wrote:
|
It would of course be the nicest solution if Currently public Subscription call(Observer<T> observer) {
for (T item : iterable) {
observer.onNext(item);
}
observer.onCompleted();
return Subscriptions.empty();
} |
We have chosen to not add concurrency (and that matches Rx Design Guideline 6.12. Avoid introducing concurrency) when Observables are created. It is up to the developer to choose to do so. This can be done within the Observable itself, or using Beyond this I'm interested in exploring lazy iterable implementations - a feature that is far easier in C# which supports async/await as part of the language. This is of particular interest to me on It is not correct though to move |
…r configurations and overriding of Spring beans.
I imagine
Observable.range
andObservable.from
are so primitive that they are expected to be in the normal Observable, but they are really blocking on subscribe which can be unexpected. In fact it took me a while wondering why my groupBy unit test (4f68c5a) did not work at first (usingrange
instead of a custom CounterSource), before I figured out that it is simply impossible to unsubscribe fromrange
.According to the plan of moving blocking operators to BlockingObservable (#272), it seems the correct place for these methods (and maybe others?) too, although strictly speaking they might not be operators but generators.
I see two possibilities:
Moving
from
andrange
to BlockingObservable:BlockingObservable<T> source = BlockingObservable.from(items);
or keeping them in Observable but changing their return type, to give the hint to the user:
BlockingObservable<T> source = Observable.from(items);
The text was updated successfully, but these errors were encountered: