Skip to content

Commit a2eb1a5

Browse files
steveguryakarnokd
authored andcommitted
Clean-up of the 2.x Design.md document (#3935)
* Take OS comments into account * Remove dead sentence.
1 parent 248e27f commit a2eb1a5

File tree

1 file changed

+21
-40
lines changed

1 file changed

+21
-40
lines changed

DESIGN.md

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Examples:
6161

6262
##### Async Pull (Async Interactive)
6363

64-
Consumer requests data when it wishes, and the data is then pushed when the producer wishes to.
64+
Consumer requests data when it wishes, and the data is then pushed when the producer wishes to.
6565

6666
Examples:
6767

@@ -90,7 +90,7 @@ Examples:
9090

9191
Containing object immediately start work when it is created.
9292

93-
Examples:
93+
Examples:
9494

9595
- A `Future` once created has work being performed and represents the eventual value of that work. It can not be deferred once created.
9696

@@ -171,13 +171,6 @@ You get a flowable from:
171171
class Flowable<T> implements Flow.Publisher<T>, io.reactivestreams.Publisher<T> {
172172
void subscribe(Subscriber<T> subscriber);
173173

174-
interface Subscriber<T> implements Flow.Subscriber<T>, io.reactivestreams.Subscriber<T> {
175-
void onNext(T t);
176-
void onError(Throwable t);
177-
void onComplete();
178-
void onSubscribe(Flowable.Subscription d);
179-
}
180-
181174
interface Subscription implements Flow.Subscription, io.reactivestreams.Subscription {
182175
void cancel();
183176
void request(long n);
@@ -212,12 +205,12 @@ Flow control:
212205
```java
213206
class Single<T> {
214207
void subscribe(Single.Subscriber<T> subscriber);
208+
}
215209

216-
interface Subscriber<T> {
217-
void onSuccess(T t);
218-
void onError(Throwable t);
219-
void onSubscribe(Disposable d);
220-
}
210+
interface SingleSubscriber<T> {
211+
void onSuccess(T t);
212+
void onError(Throwable t);
213+
void onSubscribe(Disposable d);
221214
}
222215
```
223216

@@ -228,7 +221,7 @@ class Single<T> {
228221

229222
Lazy representation of a unit of work that can complete or fail
230223

231-
- Semantic equivalent of `Observable.empty().doOnSubscribe()`.
224+
- Semantic equivalent of `Observable.empty().doOnSubscribe()`.
232225
- Alternative for scenarios often represented with types such as `Single<Void>` or `Observable<Void>`.
233226

234227
Usable for:
@@ -241,12 +234,12 @@ Usable for:
241234
```java
242235
class Completable {
243236
void subscribe(Completable.Subscriber subscriber);
237+
}
244238

245-
interface Subscriber {
246-
void onComplete();
247-
void onError(Throwable t);
248-
void onSubscribe(Disposable d);
249-
}
239+
interface CompletableSubscriber {
240+
void onComplete();
241+
void onError(Throwable t);
242+
void onSubscribe(Disposable d);
250243
}
251244
```
252245

@@ -272,7 +265,7 @@ Interactive consumer of events (with consumer-driven flow control). Involved in
272265

273266
[Reactive Streams state](https://github.com/reactive-streams/reactive-streams-jvm/blob/v1.0.0/README.md#3-subscription-code) of subscription supporting flow control and cancellation.
274267

275-
`Disposable` is a similar type used for lifecycle management on the `Observable` type without interactive flow control.
268+
`Disposable` is a similar type used for lifecycle management on the `Observable` type without interactive flow control.
276269

277270
##### Processor
278271

@@ -298,7 +291,7 @@ Subject s = PublishSubject.create();
298291
Publisher p = s.toPublisher(onBackpressureStrategy);
299292

300293
// now the request(n) semantics are handled by default
301-
p.subscribe(subscriber1);
294+
p.subscribe(subscriber1);
302295
p.subscribe(subscriber2);
303296
```
304297

@@ -307,11 +300,11 @@ In this example, `subscriber1` and `subscriber2` can consume at different rates,
307300

308301
##### Disposable
309302

310-
A type representing work that can be cancelled or disposed.
303+
A type representing work or resource that can be cancelled or disposed.
311304

312305
Examples:
313306

314-
- An `Observable.subscribe` passes a `Disposable` to the `Observable.onSubscribe` to allow the `Observer` to dispose of the subscription.
307+
- An `Observable.subscribe` passes a `Disposable` to the `Observable.onSubscribe` to allow the `Observer` to dispose of the subscription.
315308
- A `Scheduler` returns a `Disposable` that you use for disposing of the `Scheduler`.
316309

317310
`Subscription` is a similar type used for lifecycle management on the `Flowable` type with interactive flow control.
@@ -356,27 +349,15 @@ The final `subscribe` will *not* invoke `cancel`/`dispose` after receiving an `o
356349

357350
### JVM target and source compatibility
358351

359-
The 2.x version will target JDK6+ but the source will be using some of the Java 8 features.
360-
We'll use the retrolambda project to generate JDK6 Byte-code from the Java 8 sources.
361-
The only Java 8 features we intend to use are: lambda expressions, method references and try-with-resources statements.
362-
Default methods may be considered if retrolambda support reach an acceptable level of maturity.
363-
364-
It still up to discussion to know how we will generate multiple targets?
365-
Options are:
366-
367-
- two artifcat ids: rxjava-jdk6, rxjava-jdk8
368-
- classifiers: jdk6, jdk8
369-
370-
The intent is to let Android users consume the new version of RxJava.
371-
(Not sure if JDK6 is the appropriate requirement, JDK7+ is maybe sufficient).
352+
The 2.x version will target JDK6+ to let Android users consume the new version of RxJava.
372353

373-
### Future work
354+
### Future work
374355

375-
This section contains current design work which needs more discussion and elaboration before it is merged into this document as a stated goal for 2.x. Our goal is
356+
This section contains current design work which needs more discussion and elaboration before it is merged into this document as a stated goal for 2.x.
376357

377358
#### Custom Observable, Single, Completable, or Flowable
378359

379-
We are investigate a base interface (similar to `Publisher`) for the `Observable`, `Single`, and `Completable` (currently referred to as `Consumable` or `ConsumableObservable`). This would empower library owners and api developers to implement their own type of `Observable`, `Single`, or `Completable` without extending the class. This would result in a change the type signatures of `subscribe` as well as any operator that operates over an `Observable`, `Single`, or `Completable` to accept a more generic type (i.e. `ConsumableObservable`). For more information see the proof of concept project [Consumable](https://github.com/stealthcode/Consumable).
360+
We are investigate a base interface (similar to `Publisher`) for the `Observable`, `Single`, and `Completable` (currently referred to as `Consumable` or `ConsumableObservable`). This would empower library owners and api developers to implement their own type of `Observable`, `Single`, or `Completable` without extending the class. This would result in a change the type signatures of `subscribe` as well as any operator that operates over an `Observable`, `Single`, or `Completable` to accept a more generic type (i.e. `ConsumableObservable`). For more information see the proof of concept project [Consumable](https://github.com/stealthcode/Consumable).
380361

381362
#### Fusion (To be confirmed)
382363

0 commit comments

Comments
 (0)