Skip to content

Commit 63fde7d

Browse files
committed
OperatorConcat - use BackpressureUtils to prevent request overflow and add n > 0 check to prevent race condition
1 parent 24ca4f7 commit 63fde7d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/rx/internal/operators/OperatorConcat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void onStart() {
115115
private void requestFromChild(long n) {
116116
// we track 'requested' so we know whether we should subscribe the next or not
117117
ConcatInnerSubscriber<T> actualSubscriber = currentSubscriber;
118-
if (REQUESTED_UPDATER.getAndAdd(this, n) == 0) {
118+
if (n > 0 && BackpressureUtils.getAndAddRequest(REQUESTED_UPDATER, this, n) == 0) {
119119
if (actualSubscriber == null && wip > 0) {
120120
// this means we may be moving from one subscriber to another after having stopped processing
121121
// so need to kick off the subscribe via this request notification

0 commit comments

Comments
 (0)