Skip to content

Commit f4aad9e

Browse files
committed
1.2 Note on early use of Scheduler
1 parent bef4c84 commit f4aad9e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Part 1 - Getting Started/2. Key types.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ Late: 3
133133
Our late subscriber now missed the first value, which fell off the buffer of size 2. Similarily, old values fall off the buffer as time passes, when the subject is created with `createWithTime`
134134

135135
```java
136-
ReplaySubject<Integer> s = ReplaySubject.createWithTime(150, TimeUnit.MILLISECONDS, Schedulers.immediate());
136+
ReplaySubject<Integer> s = ReplaySubject.createWithTime(
137+
150, TimeUnit.MILLISECONDS,
138+
Schedulers.immediate());
137139
s.onNext(0);
138140
Thread.sleep(100);
139141
s.onNext(1);
@@ -150,6 +152,8 @@ Late: 2
150152
Late: 3
151153
```
152154

155+
Creating a `ReplaySubject` with time requires a `Scheduler`, which is Rx's way of keeping time. Feel free to ignore this for now, as we will properly introduce schedulers in the chapter about concurrency.
156+
153157
`ReplaySubject.createWithTimeAndSize` limits both, which ever comes first.
154158

155159
### BehaviorSubject

0 commit comments

Comments
 (0)