Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schedulePeriodically cannot be unsubscribed from #1344

Closed
samueltardieu opened this issue Jun 9, 2014 · 0 comments
Closed

schedulePeriodically cannot be unsubscribed from #1344

samueltardieu opened this issue Jun 9, 2014 · 0 comments

Comments

@samueltardieu
Copy link
Contributor

The subscription returned by schedulePeriodically() is automatically marked as unsubscribed when the first run terminates, after queuing the next event. As a result, the periodic event cannot be unsubscribed from once the first call() happens, as unsubscribe() will now be a no-op (as isUnsubscribed is true).

Example in the Scala REPL (with the Java bindings for RxJava 0.19):

import rx._
import rx.functions._
import rx.schedulers.Schedulers
import java.util.concurrent.TimeUnit
val s = Schedulers.io().createWorker.schedulePeriodically(new Action0 { override def call = println("In call") }, 1, 1, TimeUnit.SECONDS)
s.isUnsubscribed

Here, s.isUnsubscribed() returns false. However, if you wait one second, it will return true and s.unsubscribe() will not do anything and the constant display will continue every second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant