Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void exampleRefcount() throws InterruptedException {
Thread.sleep(500);
Subscription s2 = cold.subscribe(i -> System.out.println("Second: " + i));
Thread.sleep(500);
System.out.println("Unsubscribe first");
System.out.println("Unsubscribe second");
s2.unsubscribe();
Thread.sleep(500);
System.out.println("Unsubscribe first");
Expand All @@ -123,15 +123,19 @@ public void exampleRefcount() throws InterruptedException {
System.out.println("First connection again");
Thread.sleep(500);
s1 = cold.subscribe(i -> System.out.println("First: " + i));
Thread.sleep(900);
System.out.println("Unsubscribe first again");
s1.unsubscribe();

// First: 0
// First: 1
// First: 2
// Second: 2
// First: 3
// Second: 3
// Unsubscribe first
// First: 4
// Second: 4
// Unsubscribe second
// First: 5
// First: 6
// Unsubscribe first
Expand All @@ -140,7 +144,7 @@ public void exampleRefcount() throws InterruptedException {
// First: 1
// First: 2
// First: 3
// First: 4
// Unsubscribe first again
}


Expand Down
4 changes: 2 additions & 2 deletions tests/java/itrx/chapter4/scheduling/SubscribeOnExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ public void exampleSubscribeOn() {
System.out.println("Finished main: " + Thread.currentThread().getId());

// Main: 1
// Created on 1
// Created on 11
// Received 1 on 11
// Received 2 on 11
// Finished main: 11
// Finished main: 1
}

public void exampleIntervalThread() {
Expand Down