Skip to content

Commit

Permalink
2.x: cleanup & coverage 10/24-2 (#4763)
Browse files Browse the repository at this point in the history
  • Loading branch information
akarnokd committed Oct 25, 2016
1 parent 3634c92 commit 318bf43
Show file tree
Hide file tree
Showing 33 changed files with 1,254 additions and 338 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public void onNext(Object t) {

@Override
public void onError(Throwable t) {
parent.innerError(t);
parent.innerCloseError(t);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,10 @@ public void run() {

if (r != 0L) {
actual.onNext(count++);
if (r != Long.MAX_VALUE) {
decrementAndGet();
}
BackpressureHelper.produced(this, 1);
} else {
try {
actual.onError(new MissingBackpressureException("Can't deliver value " + count + " due to lack of requests"));
} finally {
DisposableHelper.dispose(resource);
}
actual.onError(new MissingBackpressureException("Can't deliver value " + count + " due to lack of requests"));
DisposableHelper.dispose(resource);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public FlowableJoin(
@Override
protected void subscribeActual(Subscriber<? super R> s) {

GroupJoinSubscription<TLeft, TRight, TLeftEnd, TRightEnd, R> parent =
new GroupJoinSubscription<TLeft, TRight, TLeftEnd, TRightEnd, R>(s, leftEnd, rightEnd, resultSelector);
JoinSubscription<TLeft, TRight, TLeftEnd, TRightEnd, R> parent =
new JoinSubscription<TLeft, TRight, TLeftEnd, TRightEnd, R>(s, leftEnd, rightEnd, resultSelector);

s.onSubscribe(parent);

Expand All @@ -69,7 +69,7 @@ protected void subscribeActual(Subscriber<? super R> s) {
other.subscribe(right);
}

static final class GroupJoinSubscription<TLeft, TRight, TLeftEnd, TRightEnd, R>
static final class JoinSubscription<TLeft, TRight, TLeftEnd, TRightEnd, R>
extends AtomicInteger implements Subscription, JoinSupport {


Expand Down Expand Up @@ -111,7 +111,7 @@ static final class GroupJoinSubscription<TLeft, TRight, TLeftEnd, TRightEnd, R>

static final Integer RIGHT_CLOSE = 4;

GroupJoinSubscription(Subscriber<? super R> actual, Function<? super TLeft, ? extends Publisher<TLeftEnd>> leftEnd,
JoinSubscription(Subscriber<? super R> actual, Function<? super TLeft, ? extends Publisher<TLeftEnd>> leftEnd,
Function<? super TRight, ? extends Publisher<TRightEnd>> rightEnd,
BiFunction<? super TLeft, ? super TRight, ? extends R> resultSelector) {
this.actual = actual;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ public void onNext(T t) {
long r = get();
if (r != 0L) {
actual.onNext(t);
if (r != Long.MAX_VALUE) {
decrementAndGet();
}
BackpressureHelper.produced(this, 1);
} else {
try {
onDrop.accept(t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ public void onNext(T t) {
long r = get();
if (r != 0L) {
actual.onNext(t);
if (r != Long.MAX_VALUE) {
decrementAndGet();
}
BackpressureHelper.produced(this, 1);
} else {
onError(new MissingBackpressureException("could not emit value due to lack of requests"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,14 @@ public void onNext(R t) {

@Override
public void onError(Throwable t) {
try {
actual.onError(t);
} finally {
processor.dispose();
}
actual.onError(t);
processor.dispose();
}

@Override
public void onComplete() {
try {
actual.onComplete();
} finally {
processor.dispose();
}
actual.onComplete();
processor.dispose();
}

@Override
Expand Down Expand Up @@ -214,12 +208,10 @@ public void onNext(T t) {
if (done) {
return;
}
if (sourceMode == QueueSubscription.NONE) {
if (!queue.offer(t)) {
SubscriptionHelper.cancel(s);
onError(new MissingBackpressureException());
return;
}
if (sourceMode == QueueSubscription.NONE && !queue.offer(t)) {
s.get().cancel();
onError(new MissingBackpressureException());
return;
}
drain();
}
Expand Down Expand Up @@ -473,20 +465,7 @@ static final class MulticastSubscription<T>
@Override
public void request(long n) {
if (SubscriptionHelper.validate(n)) {
for (;;) {
long r = get();
if (r == Long.MIN_VALUE) {
return;
}
if (r != Long.MAX_VALUE) {
long u = BackpressureHelper.addCap(r, n);
if (compareAndSet(r, u)) {
break;
}
} else {
break;
}
}
BackpressureHelper.addCancel(this, n);
parent.drain();
}
}
Expand Down
Loading

0 comments on commit 318bf43

Please sign in to comment.