You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment if you subscribe to an Observable with first update option, the Observer#onValue method is called immediately before the #subscribe method finishes. This behaviour is correct but the listener code is run on the calling thread of the subscribe. This is a side effect that the user has to know and can be sometime problematic (maybe subscriptions are started in the constructor of the class in the GUI thread or, even worst, the Observer#onValue throws and, potentially, kills the caller thread).
I was just wondering if we could improve this by executing the first update call on the same dispatcher pool of the Observable so that it is consistent with the, future, updates of the stream of data 🙂 . If we do this, we have to, willingly, block the caller thread until this is done so the correct behaviour mentioned above is kept.
What do you think? @michi42@kaifox It is not urgent I just wanted to document it on an issue so we don't forget about it hahaha
At the moment if you subscribe to an
Observable
with first update option, theObserver#onValue
method is called immediately before the#subscribe
method finishes. This behaviour is correct but the listener code is run on the calling thread of the subscribe. This is a side effect that the user has to know and can be sometime problematic (maybe subscriptions are started in the constructor of the class in the GUI thread or, even worst, theObserver#onValue
throws and, potentially, kills the caller thread).I was just wondering if we could improve this by executing the first update call on the same dispatcher pool of the
Observable
so that it is consistent with the, future, updates of the stream of data 🙂 . If we do this, we have to, willingly, block the caller thread until this is done so the correct behaviour mentioned above is kept.What do you think? @michi42 @kaifox It is not urgent I just wanted to document it on an issue so we don't forget about it hahaha
ossgang-commons/src/main/java/org/ossgang/commons/observables/DispatchingObservableValue.java
Lines 49 to 54 in 848de09
The text was updated successfully, but these errors were encountered: