Skip to content

Commit 3e7b1f5

Browse files
committed
first pass at javadocs for new backpressure stuff
1 parent 3a3dea1 commit 3e7b1f5

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4911,10 +4911,22 @@ public final Boolean call(T t) {
49114911
}).cast(klass);
49124912
}
49134913

4914+
/**
4915+
* Instructs an Observable that is emitting items faster than its observer can consume them to buffer these
4916+
* items indefinitely until they can be emitted.
4917+
*
4918+
* @return
4919+
* @since 0.20
4920+
*/
49144921
public final Observable<T> onBackpressureBuffer() {
49154922
return lift(new OperatorOnBackpressureBuffer<T>());
49164923
}
4917-
4924+
4925+
/**
4926+
* @warn javadoc missing
4927+
* @return
4928+
* @since 0.20
4929+
*/
49184930
public final Observable<T> onBackpressureDrop() {
49194931
return lift(new OperatorOnBackpressureDrop<T>());
49204932
}

rxjava-core/src/main/java/rx/Producer.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,20 @@
1515
*/
1616
package rx;
1717

18+
/**
19+
* @warn javadoc description missing
20+
* @since 0.20
21+
*/
1822
public interface Producer {
1923

24+
/**
25+
* Request a certain maximum number of items from this Producer. This is a way of requesting backpressure.
26+
* To disable backpressure, pass {@code Long.MAX_VALUE} to this method.
27+
*
28+
* @param n the maximum number of items you want this Producer to produce, or {@code Long.MAX_VALUE} if you
29+
* want the Producer to produce items at its own pace
30+
* @since 0.20
31+
*/
2032
public void request(long n);
2133

2234
}

rxjava-core/src/main/java/rx/Subscriber.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,26 @@ public final boolean isUnsubscribed() {
8383
return cs.isUnsubscribed();
8484
}
8585

86+
/**
87+
* This method is invoked when the Subscriber and Observable have been connected but the Observable has
88+
* not yet begun to emit items or send notifications to the Subscriber. Override this method to add any
89+
* useful initialization to your subscription, for instance to initiate backpressure.
90+
*
91+
* @since 0.20
92+
*/
8693
public void onStart() {
8794
// do nothing by default
8895
}
8996

97+
/**
98+
* Request a certain maximum number of emitted items from the Observable this Subscriber is subscribed to.
99+
* This is a way of requesting backpressure. To disable backpressure, pass {@code Long.MAX_VALUE} to this
100+
* method.
101+
*
102+
* @param n the maximum number of items you want the Observable to emit to the Subscriber at this time, or
103+
* {@code Long.MAX_VALUE} if you want the Observable to emit items at its own pace
104+
* @since 0.20
105+
*/
90106
public final void request(long n) {
91107
Producer shouldRequest = null;
92108
synchronized (this) {
@@ -102,10 +118,21 @@ public final void request(long n) {
102118
}
103119
}
104120

121+
/**
122+
* @warn javadoc description missing
123+
* @return
124+
* @since 0.20
125+
*/
105126
protected Producer onSetProducer(Producer producer) {
106127
return producer;
107128
}
108129

130+
/**
131+
* @warn javadoc description missing
132+
* @warn param producer not described
133+
* @param producer
134+
* @since 0.20
135+
*/
109136
public final void setProducer(Producer producer) {
110137
producer = onSetProducer(producer);
111138
long toRequest;

0 commit comments

Comments
 (0)