Skip to content

Commit bd2d5fe

Browse files
committed
add and improve javadoc in Subscriber
1 parent 9549363 commit bd2d5fe

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

src/main/java/rx/Subscriber.java

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,34 @@ protected Subscriber() {
4646
this(null, false);
4747
}
4848

49+
/**
50+
* Construct a Subscriber by using another Subscriber for backpressure and
51+
* for holding the subscription list (when <code>this.add(sub)</code> is
52+
* called this will in fact call <code>subscriber.add(sub)</code>).
53+
*
54+
* @param subscriber
55+
* the other Subscriber
56+
*/
4957
protected Subscriber(Subscriber<?> subscriber) {
5058
this(subscriber, true);
5159
}
5260

5361
/**
54-
* Construct a Subscriber by using another Subscriber for backpressure and optionally sharing the
55-
* underlying subscriptions list.
62+
* Construct a Subscriber by using another Subscriber for backpressure and
63+
* optionally for holding the subscription list (if
64+
* <code>shareSubscriptions</code> is <code>true</code> then when
65+
* <code>this.add(sub)</code> is called this will in fact call
66+
* <code>subscriber.add(sub)</code>).
5667
* <p>
57-
* To retain the chaining of subscribers, add the created instance to {@code op} via {@link #add}.
68+
* To retain the chaining of subscribers when setting
69+
* <code>shareSubscriptions</code> to <code>false</code>, add the created
70+
* instance to {@code subscriber} via {@link #add}.
5871
*
5972
* @param subscriber
6073
* the other Subscriber
6174
* @param shareSubscriptions
62-
* {@code true} to share the subscription list in {@code op} with this instance
75+
* {@code true} to share the subscription list in {@code subscriber} with
76+
* this instance
6377
* @since 1.0.6
6478
*/
6579
protected Subscriber(Subscriber<?> subscriber, boolean shareSubscriptions) {
@@ -158,9 +172,19 @@ private void addToRequested(long n) {
158172
}
159173

160174
/**
161-
* @warn javadoc description missing
162-
* @warn param producer not described
175+
* If other subscriber is set (by calling constructor
176+
* {@link #Subscriber(Subscriber)} or
177+
* {@link #Subscriber(Subscriber, boolean)}) then this method calls
178+
* <code>setProducer</code> on the other subscriber. If the other subscriber
179+
* is not set and no requests have been made to this subscriber then
180+
* <code>p.request(Long.MAX_VALUE)</code> is called. If the other subscriber
181+
* is not set and some requests have been made to this subscriber then
182+
* <code>p.request(n)</code> is called where n is the accumulated requests
183+
* to this subscriber.
184+
*
163185
* @param p
186+
* producer to be used by this subscriber or the other subscriber
187+
* (or recursively its other subscriber) to make requests from
164188
*/
165189
public void setProducer(Producer p) {
166190
long toRequest;

0 commit comments

Comments
 (0)