Skip to content

Commit

Permalink
Avoid request(0) to trigger a recursive call.
Browse files Browse the repository at this point in the history
  • Loading branch information
akarnokd committed Nov 19, 2014
1 parent 3c46285 commit 752c2a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/rx/internal/operators/OperatorMerge.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ private boolean drainQueuesIfNeeded() {
} finally {
boolean moreToDrain = releaseEmitLock();
// request outside of lock
request(emitted);
if (emitted > 0) {
request(emitted);
}
if (!moreToDrain) {
return true;
}
Expand Down Expand Up @@ -524,6 +526,7 @@ private static final class InnerSubscriber<T> extends Subscriber<T> {
final MergeSubscriber<T> parentSubscriber;
final MergeProducer<T> producer;
/** Make sure the inner termination events are delivered only once. */
@SuppressWarnings("unused")
volatile int terminated;
@SuppressWarnings("rawtypes")
static final AtomicIntegerFieldUpdater<InnerSubscriber> ONCE_TERMINATED = AtomicIntegerFieldUpdater.newUpdater(InnerSubscriber.class, "terminated");
Expand Down

0 comments on commit 752c2a7

Please sign in to comment.