@@ -107,7 +107,7 @@ public <T> Subscription schedulePeriodically(T state, final Func2<Scheduler, T,
107
107
final Func2 <Scheduler , T , Subscription > recursiveAction = new Func2 <Scheduler , T , Subscription >() {
108
108
@ Override
109
109
public Subscription call (Scheduler scheduler , T state0 ) {
110
- if (! complete .get ()) {
110
+ if (!complete .get ()) {
111
111
long startedAt = now ();
112
112
final Subscription sub1 = action .call (scheduler , state0 );
113
113
long timeTakenByActionInNanos = TimeUnit .MILLISECONDS .toNanos (now () - startedAt );
@@ -343,7 +343,7 @@ public void testPeriodicScheduling() {
343
343
final Func1 <Long , Void > calledOp = mock (Func1 .class );
344
344
345
345
final TestScheduler scheduler = new TestScheduler ();
346
- scheduler .schedulePeriodically (new Action0 () {
346
+ Subscription subscription = scheduler .schedulePeriodically (new Action0 () {
347
347
@ Override public void call () {
348
348
System .out .println (scheduler .now ());
349
349
calledOp .call (scheduler .now ());
@@ -369,6 +369,10 @@ public void testPeriodicScheduling() {
369
369
scheduler .advanceTimeBy (5L , TimeUnit .SECONDS );
370
370
inOrder .verify (calledOp , times (1 )).call (5000L );
371
371
inOrder .verify (calledOp , times (1 )).call (7000L );
372
+
373
+ subscription .unsubscribe ();
374
+ scheduler .advanceTimeBy (11L , TimeUnit .SECONDS );
375
+ inOrder .verify (calledOp , never ()).call (anyLong ());
372
376
}
373
377
}
374
378
}
0 commit comments