-
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
1.X: UnicastSubject fail-fast and delay-error behavior #5195
Conversation
…iption if onError is also called prior to subscription.
Codecov Report
@@ Coverage Diff @@
## 1.x #5195 +/- ##
============================================
+ Coverage 84.36% 84.38% +0.02%
- Complexity 2880 2883 +3
============================================
Files 290 290
Lines 18115 18123 +8
Branches 2478 2479 +1
============================================
+ Hits 15282 15293 +11
+ Misses 1964 1961 -3
Partials 869 869
Continue to review full report at Codecov.
|
@@ -272,8 +309,7 @@ void replay() { | |||
if (s != null) { | |||
boolean d = done; | |||
boolean empty = q.isEmpty(); | |||
|
|||
if (checkTerminated(d, empty, s)) { | |||
if (checkTerminated(d, empty, delayError, s)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have a local delayError field for this, otherwise you are re-reading the flag on each emission which can cause unnecessary false sharing.
Queue<Object> q = queue;
boolean delayError = this.delayError;
// ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Thanks! |
This PR adds support for delay-error behavior to
UnicastSubject
with methodsUnicastSubject<T> create(boolean delayError)
,UnicastSubject<T> create(int capacityHint, Action0 onTerminated, boolean delayError)
. Behavior of existing factory methods was not changed, and is fail-fast.Relates to #5165