Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Commit 899c1d2

Browse files
committed
Linked to examples
1 parent e330cbb commit 899c1d2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Part 4 - Concurrency/4. Backpressure.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Observable.interval(1, TimeUnit.MILLISECONDS)
3838
},
3939
System.out::println);
4040
```
41-
Output
41+
[Output](/tests/java/itrx/chapter4/backpressure/NoBackpressureExample.java)
4242
```
4343
0
4444
1
@@ -69,7 +69,7 @@ Observable.interval(1, TimeUnit.MILLISECONDS)
6969
},
7070
System.out::println);
7171
```
72-
Output
72+
[Output](/tests/java/itrx/chapter4/backpressure/ConsumerSideExample.java)
7373
```
7474
82
7575
182
@@ -100,7 +100,7 @@ Observable.interval(10, TimeUnit.MILLISECONDS)
100100
},
101101
System.out::println);
102102
```
103-
Output
103+
[Output](/tests/java/itrx/chapter4/backpressure/ConsumerSideExample.java)
104104
```
105105
[0, 1, 2, 3, 4, 5, 6, 7]
106106
[8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
@@ -160,15 +160,15 @@ Observable.range(0, 3)
160160
.doOnRequest(i -> System.out.println("Requested " + i))
161161
.subscribe(System.out::println);
162162
```
163-
Output
163+
[Output](/tests/java/itrx/chapter4/backpressure/OnRequestExample.java)
164164
```
165165
Requested 9223372036854775807
166166
0
167167
1
168168
2
169169
```
170170

171-
We see that `subscribe` requests the maximum number of items from the beginning. This means that `subscribe` doesn't resist values at all. Subscribe will only use backpressure if we provide a subscriber that implements backpressure. Here is a complete example for such an implementation
171+
We see that `subscribe` requests the maximum number of items from the beginning. This means that `subscribe` doesn't resist values at all. Subscribe will only use backpressure if we provide a subscriber that implements backpressure. Here is a complete [example for a subscriber](/tests/java/itrx/chapter4/backpressure/ControlledPullSubscriber.java), which will allow us to control backpressure from the outside.
172172

173173
```java
174174
public class ControlledPullSubscriber<T> extends Subscriber<T> {
@@ -235,7 +235,7 @@ Observable.range(0, 3)
235235
puller.requestMore(2);
236236
puller.requestMore(1);
237237
```
238-
Output
238+
[Output](/tests/java/itrx/chapter4/backpressure/OnRequestExample.java)
239239
```
240240
Requested 0
241241
Requested 2
@@ -258,7 +258,7 @@ Observable.range(0, 300)
258258
.take(300)
259259
.subscribe();
260260
```
261-
Output
261+
[Output](/tests/java/itrx/chapter4/backpressure/OnRequestExample.java)
262262
```
263263
Requested 128
264264
Requested 90
@@ -297,7 +297,7 @@ Observable.interval(1, TimeUnit.MILLISECONDS)
297297
System.out::println
298298
);
299299
```
300-
Output
300+
[Output](/tests/java/itrx/chapter4/backpressure/OnBackpressureExample.java)
301301
```
302302
0
303303
1
@@ -335,7 +335,7 @@ Observable.interval(1, TimeUnit.MILLISECONDS)
335335
},
336336
System.out::println);
337337
```
338-
Output
338+
[Output](/tests/java/itrx/chapter4/backpressure/OnBackpressureExample.java)
339339
```
340340
0
341341
1

0 commit comments

Comments
 (0)