Skip to content

Commit b041e32

Browse files
authored
2.x: Use different wording on blockingForEach() JavaDocs (#6057)
1 parent 6dd1648 commit b041e32

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

src/main/java/io/reactivex/Flowable.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5472,20 +5472,18 @@ public final T blockingFirst(T defaultItem) {
54725472
}
54735473

54745474
/**
5475-
* Invokes a method on each item emitted by this {@code Flowable} and blocks until the Flowable
5476-
* completes.
5477-
* <p>
5478-
* <em>Note:</em> This will block even if the underlying Flowable is asynchronous.
5475+
* Consumes the upstream {@code Flowable} in a blocking fashion and invokes the given
5476+
* {@code Consumer} with each upstream item on the <em>current thread</em> until the
5477+
* upstream terminates.
54795478
* <p>
54805479
* <img width="640" height="330" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/B.forEach.png" alt="">
54815480
* <p>
5482-
* This is similar to {@link Flowable#subscribe(Subscriber)}, but it blocks. Because it blocks it does not
5483-
* need the {@link Subscriber#onComplete()} or {@link Subscriber#onError(Throwable)} methods. If the
5484-
* underlying Flowable terminates with an error, rather than calling {@code onError}, this method will
5485-
* throw an exception.
5486-
*
5487-
* <p>The difference between this method and {@link #subscribe(Consumer)} is that the {@code onNext} action
5488-
* is executed on the emission thread instead of the current thread.
5481+
* <em>Note:</em> the method will only return if the upstream terminates or the current
5482+
* thread is interrupted.
5483+
* <p>
5484+
* <p>This method executes the {@code Consumer} on the current thread while
5485+
* {@link #subscribe(Consumer)} executes the consumer on the original caller thread of the
5486+
* sequence.
54895487
* <dl>
54905488
* <dt><b>Backpressure:</b></dt>
54915489
* <dd>The operator consumes the source {@code Flowable} in an unbounded manner

src/main/java/io/reactivex/Observable.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5018,20 +5018,18 @@ public final T blockingFirst(T defaultItem) {
50185018
}
50195019

50205020
/**
5021-
* Invokes a method on each item emitted by this {@code Observable} and blocks until the Observable
5022-
* completes.
5023-
* <p>
5024-
* <em>Note:</em> This will block even if the underlying Observable is asynchronous.
5021+
* Consumes the upstream {@code Observable} in a blocking fashion and invokes the given
5022+
* {@code Consumer} with each upstream item on the <em>current thread</em> until the
5023+
* upstream terminates.
50255024
* <p>
50265025
* <img width="640" height="330" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/blockingForEach.o.png" alt="">
50275026
* <p>
5028-
* This is similar to {@link Observable#subscribe(Observer)}, but it blocks. Because it blocks it does not
5029-
* need the {@link Observer#onComplete()} or {@link Observer#onError(Throwable)} methods. If the
5030-
* underlying Observable terminates with an error, rather than calling {@code onError}, this method will
5031-
* throw an exception.
5032-
*
5033-
* <p>The difference between this method and {@link #subscribe(Consumer)} is that the {@code onNext} action
5034-
* is executed on the emission thread instead of the current thread.
5027+
* <em>Note:</em> the method will only return if the upstream terminates or the current
5028+
* thread is interrupted.
5029+
* <p>
5030+
* <p>This method executes the {@code Consumer} on the current thread while
5031+
* {@link #subscribe(Consumer)} executes the consumer on the original caller thread of the
5032+
* sequence.
50355033
* <dl>
50365034
* <dt><b>Scheduler:</b></dt>
50375035
* <dd>{@code blockingForEach} does not operate by default on a particular {@link Scheduler}.</dd>

0 commit comments

Comments
 (0)