Commit 4e49516c authored by Julien Sadaoui's avatar Julien Sadaoui
Browse files

Fix: RxJava - Level6

parent 94a2882b
......@@ -56,7 +56,7 @@ public class Level6 {
ExecutorService executorService = Executors.newSingleThreadExecutor();
Observable<Integer> observable = Observable.create(subscriber -> executorService.submit(() -> {
IntStream.range(1, 5).forEach(value -> {
IntStream.rangeClosed(1, 5).forEach(value -> {
log.info("Sending: {}", value);
subscriber.onNext(value);
Helpers.sleep(500, TimeUnit.MILLISECONDS);
......@@ -97,6 +97,8 @@ public class Level6 {
* <li>[RxSingleScheduler-1] Received: 3</li>
* <li>[RxSingleScheduler-1] Sending: 4</li>
* <li>[RxSingleScheduler-1] Received: 4</li>
* <li>[RxSingleScheduler-1] Sending: 5</li>
* <li>[RxSingleScheduler-1] Received: 5</li>
* <li>[RxSingleScheduler-1] Completed</li>
* </ul>
*
......@@ -108,7 +110,7 @@ public class Level6 {
CountDownLatch latch = new CountDownLatch(1);
Observable<Integer> observable = Observable.create(subscriber -> {
IntStream.range(1, 5).forEach(value -> {
IntStream.rangeClosed(1, 5).forEach(value -> {
log.info("Sending: {}", value);
subscriber.onNext(value);
Helpers.sleep(200, TimeUnit.MILLISECONDS);
......@@ -146,6 +148,8 @@ public class Level6 {
* <li>[xSingleScheduler-1] Received: 3</li>
* <li>[main] Sending: 4</li>
* <li>[RxSingleScheduler-1] Received: 4</li>
* <li>[main] Sending: 5</li>
* <li>[RxSingleScheduler-1] Received: 5</li>
* <li>[main] Subscribed</li>
* <li>[RxSingleScheduler-1] Completed</li>
* </ul>
......@@ -156,7 +160,7 @@ public class Level6 {
log.info("Start Level6/Exercise3");
Observable<Integer> observable = Observable.create(subscriber -> {
IntStream.range(1, 5).forEach(value -> {
IntStream.rangeClosed(1, 5).forEach(value -> {
log.info("Sending: {}", value);
subscriber.onNext(value);
Helpers.sleep(100, TimeUnit.MILLISECONDS);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment