-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Why doesn't CompositeSubscription have a way to re-initialize its instance? #2959
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
Comments
RxJava containers are designed with a terminal state in mind. When a container gets into its terminal state via The In android terms, imagine you have a background task which wants to add a Subscription to the app composite just after your app is signalled to pause. Without a guaranteed terminal state, your async task would succeed and now you have a resource leak. With the guaranteed terminal state, the resource is immediately unsubscribed and no leak happens. As the article says, you need to replace the composite with a fresh one and restart any async observations as needed. |
Thanks to describe details. I have understood that it is designated behavior and making a new instance of CompositeSubscription is the only way to control it. |
JavaDoc says clear() makes the composite "unoperative state", but actually it does NOT.
|
As this article says,
CompositeSubscription
is hard to use in Android activities / fragments because there is no way to re-initialize its instance.I wonder why its
clear()
method does not clear its state. Is there any reason about it? Or, is it just a bug in COmpositeSubscription?The text was updated successfully, but these errors were encountered: