Skip to content

add and improve javadoc in Subscriber #3058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions src/main/java/rx/Subscriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,34 @@ protected Subscriber() {
this(null, false);
}

/**
* Construct a Subscriber by using another Subscriber for backpressure and
* for holding the subscription list (when <code>this.add(sub)</code> is
* called this will in fact call <code>subscriber.add(sub)</code>).
*
* @param subscriber
* the other Subscriber
*/
protected Subscriber(Subscriber<?> subscriber) {
this(subscriber, true);
}

/**
* Construct a Subscriber by using another Subscriber for backpressure and optionally sharing the
* underlying subscriptions list.
* Construct a Subscriber by using another Subscriber for backpressure and
* optionally for holding the subscription list (if
* <code>shareSubscriptions</code> is <code>true</code> then when
* <code>this.add(sub)</code> is called this will in fact call
* <code>subscriber.add(sub)</code>).
* <p>
* To retain the chaining of subscribers, add the created instance to {@code op} via {@link #add}.
* To retain the chaining of subscribers when setting
* <code>shareSubscriptions</code> to <code>false</code>, add the created
* instance to {@code subscriber} via {@link #add}.
*
* @param subscriber
* the other Subscriber
* @param shareSubscriptions
* {@code true} to share the subscription list in {@code op} with this instance
* {@code true} to share the subscription list in {@code subscriber} with
* this instance
* @since 1.0.6
*/
protected Subscriber(Subscriber<?> subscriber, boolean shareSubscriptions) {
Expand Down Expand Up @@ -158,9 +172,19 @@ private void addToRequested(long n) {
}

/**
* @warn javadoc description missing
* @warn param producer not described
* If other subscriber is set (by calling constructor
* {@link #Subscriber(Subscriber)} or
* {@link #Subscriber(Subscriber, boolean)}) then this method calls
* <code>setProducer</code> on the other subscriber. If the other subscriber
* is not set and no requests have been made to this subscriber then
* <code>p.request(Long.MAX_VALUE)</code> is called. If the other subscriber
* is not set and some requests have been made to this subscriber then
* <code>p.request(n)</code> is called where n is the accumulated requests
* to this subscriber.
*
* @param p
* producer to be used by this subscriber or the other subscriber
* (or recursively its other subscriber) to make requests from
*/
public void setProducer(Producer p) {
long toRequest;
Expand Down