Skip to content

Commit 421b9a4

Browse files
btilbrook-nextfazeakarnokd
authored andcommitted
2.x: Document size-bounded replay emission retention caveat (#5827) (#5828)
1 parent b8380e2 commit 421b9a4

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11234,6 +11234,9 @@ public final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publ
1123411234
* emitted by a {@link ConnectableFlowable} that shares a single subscription to the source Publisher,
1123511235
* replaying {@code bufferSize} notifications.
1123611236
* <p>
11237+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
11238+
* {@code bufferSize} source emissions.
11239+
* <p>
1123711240
* <img width="640" height="440" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.fn.png" alt="">
1123811241
* <dl>
1123911242
* <dt><b>Backpressure:</b></dt>
@@ -11270,6 +11273,9 @@ public final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publ
1127011273
* emitted by a {@link ConnectableFlowable} that shares a single subscription to the source Publisher,
1127111274
* replaying no more than {@code bufferSize} items that were emitted within a specified time window.
1127211275
* <p>
11276+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
11277+
* {@code bufferSize} source emissions.
11278+
* <p>
1127311279
* <img width="640" height="445" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.fnt.png" alt="">
1127411280
* <dl>
1127511281
* <dt><b>Backpressure:</b></dt>
@@ -11309,6 +11315,9 @@ public final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publ
1130911315
* emitted by a {@link ConnectableFlowable} that shares a single subscription to the source Publisher,
1131011316
* replaying no more than {@code bufferSize} items that were emitted within a specified time window.
1131111317
* <p>
11318+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
11319+
* {@code bufferSize} source emissions.
11320+
* <p>
1131211321
* <img width="640" height="445" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.fnts.png" alt="">
1131311322
* <dl>
1131411323
* <dt><b>Backpressure:</b></dt>
@@ -11357,6 +11366,9 @@ public final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publ
1135711366
* emitted by a {@link ConnectableFlowable} that shares a single subscription to the source Publisher,
1135811367
* replaying a maximum of {@code bufferSize} items.
1135911368
* <p>
11369+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
11370+
* {@code bufferSize} source emissions.
11371+
* <p>
1136011372
* <img width="640" height="440" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.fns.png" alt="">
1136111373
* <dl>
1136211374
* <dt><b>Backpressure:</b></dt>
@@ -11512,6 +11524,9 @@ public final <R> Flowable<R> replay(final Function<? super Flowable<T>, ? extend
1151211524
* an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only
1151311525
* when its {@code connect} method is called.
1151411526
* <p>
11527+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
11528+
* {@code bufferSize} source emissions.
11529+
* <p>
1151511530
* <img width="640" height="515" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.n.png" alt="">
1151611531
* <dl>
1151711532
* <dt><b>Backpressure:</b></dt>
@@ -11542,6 +11557,9 @@ public final ConnectableFlowable<T> replay(final int bufferSize) {
1154211557
* Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is
1154311558
* subscribed to, but only when its {@code connect} method is called.
1154411559
* <p>
11560+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
11561+
* {@code bufferSize} source emissions.
11562+
* <p>
1154511563
* <img width="640" height="515" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.nt.png" alt="">
1154611564
* <dl>
1154711565
* <dt><b>Backpressure:</b></dt>
@@ -11576,6 +11594,9 @@ public final ConnectableFlowable<T> replay(int bufferSize, long time, TimeUnit u
1157611594
* Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items
1157711595
* when it is subscribed to, but only when its {@code connect} method is called.
1157811596
* <p>
11597+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
11598+
* {@code bufferSize} source emissions.
11599+
* <p>
1157911600
* <img width="640" height="515" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.nts.png" alt="">
1158011601
* <dl>
1158111602
* <dt><b>Backpressure:</b></dt>
@@ -11618,6 +11639,9 @@ public final ConnectableFlowable<T> replay(final int bufferSize, final long time
1161811639
* an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only
1161911640
* when its {@code connect} method is called.
1162011641
* <p>
11642+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
11643+
* {@code bufferSize} source emissions.
11644+
* <p>
1162111645
* <img width="640" height="515" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.ns.png" alt="">
1162211646
* <dl>
1162311647
* <dt><b>Backpressure:</b></dt>

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9498,6 +9498,9 @@ public final <R> Observable<R> replay(Function<? super Observable<T>, ? extends
94989498
* emitted by a {@link ConnectableObservable} that shares a single subscription to the source ObservableSource,
94999499
* replaying {@code bufferSize} notifications.
95009500
* <p>
9501+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
9502+
* {@code bufferSize} source emissions.
9503+
* <p>
95019504
* <img width="640" height="391" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.o.fn.png" alt="">
95029505
* <dl>
95039506
* <dt><b>Scheduler:</b></dt>
@@ -9529,6 +9532,9 @@ public final <R> Observable<R> replay(Function<? super Observable<T>, ? extends
95299532
* emitted by a {@link ConnectableObservable} that shares a single subscription to the source ObservableSource,
95309533
* replaying no more than {@code bufferSize} items that were emitted within a specified time window.
95319534
* <p>
9535+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
9536+
* {@code bufferSize} source emissions.
9537+
* <p>
95329538
* <img width="640" height="350" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.o.fnt.png" alt="">
95339539
* <dl>
95349540
* <dt><b>Scheduler:</b></dt>
@@ -9563,6 +9569,9 @@ public final <R> Observable<R> replay(Function<? super Observable<T>, ? extends
95639569
* emitted by a {@link ConnectableObservable} that shares a single subscription to the source ObservableSource,
95649570
* replaying no more than {@code bufferSize} items that were emitted within a specified time window.
95659571
* <p>
9572+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
9573+
* {@code bufferSize} source emissions.
9574+
* <p>
95669575
* <img width="640" height="328" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.o.fnts.png" alt="">
95679576
* <dl>
95689577
* <dt><b>Scheduler:</b></dt>
@@ -9606,6 +9615,9 @@ public final <R> Observable<R> replay(Function<? super Observable<T>, ? extends
96069615
* emitted by a {@link ConnectableObservable} that shares a single subscription to the source ObservableSource,
96079616
* replaying a maximum of {@code bufferSize} items.
96089617
* <p>
9618+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
9619+
* {@code bufferSize} source emissions.
9620+
* <p>
96099621
* <img width="640" height="362" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.o.fns.png" alt="">
96109622
* <dl>
96119623
* <dt><b>Scheduler:</b></dt>
@@ -9740,6 +9752,9 @@ public final <R> Observable<R> replay(final Function<? super Observable<T>, ? ex
97409752
* an ordinary ObservableSource, except that it does not begin emitting items when it is subscribed to, but only
97419753
* when its {@code connect} method is called.
97429754
* <p>
9755+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
9756+
* {@code bufferSize} source emissions.
9757+
* <p>
97439758
* <img width="640" height="445" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.o.n.png" alt="">
97449759
* <dl>
97459760
* <dt><b>Scheduler:</b></dt>
@@ -9765,6 +9780,9 @@ public final ConnectableObservable<T> replay(final int bufferSize) {
97659780
* ObservableSource resembles an ordinary ObservableSource, except that it does not begin emitting items when it is
97669781
* subscribed to, but only when its {@code connect} method is called.
97679782
* <p>
9783+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
9784+
* {@code bufferSize} source emissions.
9785+
* <p>
97689786
* <img width="640" height="445" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.o.nt.png" alt="">
97699787
* <dl>
97709788
* <dt><b>Scheduler:</b></dt>
@@ -9794,6 +9812,9 @@ public final ConnectableObservable<T> replay(int bufferSize, long time, TimeUnit
97949812
* Connectable ObservableSource resembles an ordinary ObservableSource, except that it does not begin emitting items
97959813
* when it is subscribed to, but only when its {@code connect} method is called.
97969814
* <p>
9815+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
9816+
* {@code bufferSize} source emissions.
9817+
* <p>
97979818
* <img width="640" height="445" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.o.nts.png" alt="">
97989819
* <dl>
97999820
* <dt><b>Scheduler:</b></dt>
@@ -9830,6 +9851,9 @@ public final ConnectableObservable<T> replay(final int bufferSize, final long ti
98309851
* an ordinary ObservableSource, except that it does not begin emitting items when it is subscribed to, but only
98319852
* when its {@code connect} method is called.
98329853
* <p>
9854+
* Note that due to concurrency requirements, {@code replay(bufferSize)} may hold strong references to more than
9855+
* {@code bufferSize} source emissions.
9856+
* <p>
98339857
* <img width="640" height="445" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/replay.o.ns.png" alt="">
98349858
* <dl>
98359859
* <dt><b>Scheduler:</b></dt>

src/main/java/io/reactivex/processors/ReplayProcessor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
* if an individual item gets delayed due to backpressure.
6767
*
6868
* <p>
69+
* Due to concurrency requirements, a size-bounded {@code ReplayProcessor} may hold strong references to more source
70+
* emissions than specified.
71+
*
72+
* <p>
6973
* Example usage:
7074
* <pre> {@code
7175

src/main/java/io/reactivex/subjects/ReplaySubject.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@
9292
* {@link #getThrowable()} and {@link #hasObservers()} as well as means to read the retained/cached items
9393
* in a non-blocking and thread-safe manner via {@link #hasValue()}, {@link #getValue()},
9494
* {@link #getValues()} or {@link #getValues(Object[])}.
95+
* <p>
96+
* Note that due to concurrency requirements, a size-bounded {@code ReplaySubject} may hold strong references to more
97+
* source emissions than specified.
9598
* <dl>
9699
* <dt><b>Scheduler:</b></dt>
97100
* <dd>{@code ReplaySubject} does not operate by default on a particular {@link io.reactivex.Scheduler} and

0 commit comments

Comments
 (0)