Skip to content

Commit fba05ea

Browse files
authored
2.x: implement ops, add javadoc, remove unused components 8/19-2 (#4378)
1 parent 60bf4fc commit fba05ea

File tree

88 files changed

+2300
-1887
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2300
-1887
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ dependencies {
2828
testCompile 'junit:junit:4.12'
2929
testCompile 'org.mockito:mockito-core:1.10.19'
3030

31-
perfCompile 'org.openjdk.jmh:jmh-core:1.11.3'
32-
perfCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.11.3'
31+
perfCompile 'org.openjdk.jmh:jmh-core:1.13'
32+
perfCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.13'
3333
}
3434

3535
javadoc {
36-
exclude "**/rx/internal/**"
36+
exclude "**/internal/**"
3737
exclude "**/test/**"
3838
exclude "**/perf/**"
3939
options {

src/main/java/io/reactivex/BackpressureStrategy.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@
1313

1414
package io.reactivex;
1515

16+
/**
17+
* Represents the options for applying backpressure to a source sequence.
18+
*/
1619
public enum BackpressureStrategy {
20+
/**
21+
* Buffer all values (unbounded) until there is a downstream demand for it.
22+
*/
1723
BUFFER,
24+
/**
25+
* Drop the value if there is no current demand for it from the downstream.
26+
*/
1827
DROP,
28+
/**
29+
* Have a latest value always available and overwrite it with more recent ones
30+
* if there is no demand for it from the downstream.
31+
*/
1932
LATEST
2033
}

src/main/java/io/reactivex/Completable.java

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,25 +1430,6 @@ public final Disposable subscribe(final Action onComplete, final Consumer<? supe
14301430
return s;
14311431
}
14321432

1433-
/**
1434-
* Subscribes a non-backpressure Observer to this Completable instance which
1435-
* will receive only an onError or onComplete event.
1436-
* <dl>
1437-
* <dt><b>Scheduler:</b></dt>
1438-
* <dd>{@code subscribe} does not operate by default on a particular {@link Scheduler}.</dd>
1439-
* </dl>
1440-
* @param <T> the Observer's value type
1441-
* @param observer the Observer instance, not null
1442-
* @throws NullPointerException if s is null
1443-
*/
1444-
@SchedulerSupport(SchedulerSupport.NONE)
1445-
public final <T> void subscribe(final Observer<? super T> observer) {
1446-
Objects.requireNonNull(observer, "s is null");
1447-
1448-
ObserverCompletableObserver<T> os = new ObserverCompletableObserver<T>(observer);
1449-
subscribe(os);
1450-
}
1451-
14521433
/**
14531434
* Subscribes to this Completable and calls the given Action when this Completable
14541435
* completes normally.
@@ -1470,24 +1451,6 @@ public final Disposable subscribe(final Action onComplete) {
14701451
return s;
14711452
}
14721453

1473-
/**
1474-
* Subscribes a reactive-streams Subscriber to this Completable instance which
1475-
* will receive only an onError or onComplete event.
1476-
* <dl>
1477-
* <dt><b>Scheduler:</b></dt>
1478-
* <dd>{@code subscribe} does not operate by default on a particular {@link Scheduler}.</dd>
1479-
* </dl>
1480-
* @param <T> the value type of the subscriber
1481-
* @param s the reactive-streams Subscriber, not null
1482-
* @throws NullPointerException if s is null
1483-
*/
1484-
@SchedulerSupport(SchedulerSupport.NONE)
1485-
public final <T> void subscribe(Subscriber<T> s) {
1486-
Objects.requireNonNull(s, "s is null");
1487-
SubscriberCompletableObserver<T> os = new SubscriberCompletableObserver<T>(s);
1488-
subscribe(os);
1489-
}
1490-
14911454
/**
14921455
* Returns a Completable which subscribes the child subscriber on the specified scheduler, making
14931456
* sure the subscription side-effects happen on that specific thread of the scheduler.
@@ -1718,7 +1681,7 @@ public final Completable unsubscribeOn(final Scheduler scheduler) {
17181681
*/
17191682
public final TestSubscriber<Void> test() {
17201683
TestSubscriber<Void> ts = new TestSubscriber<Void>();
1721-
subscribe(ts);
1684+
subscribe(new SubscriberCompletableObserver<Void>(ts));
17221685
return ts;
17231686
}
17241687

@@ -1732,7 +1695,7 @@ public final TestSubscriber<Void> test() {
17321695
public final TestSubscriber<Void> test(boolean cancelled) {
17331696
TestSubscriber<Void> ts = new TestSubscriber<Void>();
17341697
ts.dispose();
1735-
subscribe(ts);
1698+
subscribe(new SubscriberCompletableObserver<Void>(ts));
17361699
return ts;
17371700
}
17381701
}

src/main/java/io/reactivex/FlowableTransformer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
import io.reactivex.functions.Function;
1919

2020
/**
21-
* Interface to compose observables.
21+
* Interface to compose Flowables.
2222
*
23-
* @param <T> the upstream value type
24-
* @param <R> the downstream value type
23+
* @param <Upstream> the upstream value type
24+
* @param <Downstream> the downstream value type
2525
*/
26-
public interface FlowableTransformer<T, R> extends Function<Flowable<T>, Publisher<? extends R>> {
26+
public interface FlowableTransformer<Upstream, Downstream> extends Function<Flowable<Upstream>, Publisher<? extends Downstream>> {
2727

2828
}

src/main/java/io/reactivex/ObservableOperator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

1616
import io.reactivex.functions.Function;
1717

18+
/**
19+
* Interface to map/wrap a downstream subscriber to an upstream Observer.
20+
*
21+
* @param <Downstream> the value type of the downstream
22+
* @param <Upstream> the value type of the upstream
23+
*/
1824
public interface ObservableOperator<Downstream, Upstream> extends Function<Observer<? super Downstream>, Observer<? super Upstream>> {
1925

2026
}

src/main/java/io/reactivex/ObservableTransformer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

1616
import io.reactivex.functions.Function;
1717

18+
/**
19+
* Interface to compose Observables.
20+
*
21+
* @param <Upstream> the upstream value type
22+
* @param <Downstream> the downstream value type
23+
*/
1824
public interface ObservableTransformer<Upstream, Downstream> extends Function<Observable<Upstream>, ObservableSource<Downstream>> {
1925

2026
}

0 commit comments

Comments
 (0)