Skip to content

Commit

Permalink
3.x: Remove unnecessary cancel/dispose calls from terminating using (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
akarnokd authored Nov 30, 2020
1 parent cdc7510 commit bfd242d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import io.reactivex.rxjava3.annotations.NonNull;

/**
* Represents a Reactive-Streams inspired {@link Subscriber} that is RxJava 2 only
* and weakens rules §1.3 and §3.9 of the specification for gaining performance.
* Represents a Reactive-Streams inspired {@link Subscriber} that is RxJava 3 only
* and weakens the Reactive Streams rules <a href='https://github.com/reactive-streams/reactive-streams-jvm#1.3'>§1.3</a>
* and <a href='https://github.com/reactive-streams/reactive-streams-jvm#3.9'>§3.9</a> of the specification
* for gaining performance.
*
* <p>History: 2.0.7 - experimental; 2.1 - beta
* @param <T> the value type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,13 @@ public void onError(Throwable t) {
}
}

upstream.cancel();
if (innerError != null) {
downstream.onError(new CompositeException(t, innerError));
} else {
downstream.onError(t);
}
} else {
downstream.onError(t);
upstream.cancel();
disposeResource();
}
}
Expand All @@ -143,11 +141,9 @@ public void onComplete() {
}
}

upstream.cancel();
downstream.onComplete();
} else {
downstream.onComplete();
upstream.cancel();
disposeResource();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ public void onError(Throwable t) {
}
}

upstream.dispose();
downstream.onError(t);
} else {
downstream.onError(t);
upstream.dispose();
disposeResource();
}
}
Expand All @@ -137,11 +135,9 @@ public void onComplete() {
}
}

upstream.dispose();
downstream.onComplete();
} else {
downstream.onComplete();
upstream.dispose();
disposeResource();
}
}
Expand Down

0 comments on commit bfd242d

Please sign in to comment.