Skip to content

Commit 0feddc1

Browse files
authored
Merge pull request #2 from ultraon/ultraon-patch-2
Fixed result output
2 parents 27ad060 + 135d65f commit 0feddc1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/java/itrx/chapter3/hotandcold/ConnectableObservableExample.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void exampleRefcount() throws InterruptedException {
114114
Thread.sleep(500);
115115
Subscription s2 = cold.subscribe(i -> System.out.println("Second: " + i));
116116
Thread.sleep(500);
117-
System.out.println("Unsubscribe first");
117+
System.out.println("Unsubscribe second");
118118
s2.unsubscribe();
119119
Thread.sleep(500);
120120
System.out.println("Unsubscribe first");
@@ -123,15 +123,19 @@ public void exampleRefcount() throws InterruptedException {
123123
System.out.println("First connection again");
124124
Thread.sleep(500);
125125
s1 = cold.subscribe(i -> System.out.println("First: " + i));
126+
Thread.sleep(900);
127+
System.out.println("Unsubscribe first again");
128+
s1.unsubscribe();
126129

127130
// First: 0
128131
// First: 1
129132
// First: 2
130133
// Second: 2
131134
// First: 3
132135
// Second: 3
133-
// Unsubscribe first
134136
// First: 4
137+
// Second: 4
138+
// Unsubscribe second
135139
// First: 5
136140
// First: 6
137141
// Unsubscribe first
@@ -140,7 +144,7 @@ public void exampleRefcount() throws InterruptedException {
140144
// First: 1
141145
// First: 2
142146
// First: 3
143-
// First: 4
147+
// Unsubscribe first again
144148
}
145149

146150

0 commit comments

Comments
 (0)