Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning RxJava

You're reading from   Learning RxJava Build concurrent applications using reactive programming with the latest features of RxJava 3

Arrow left icon
Product type Paperback
Published in Feb 2020
Publisher Packt
ISBN-13 9781789950151
Length 412 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Nick Samoylov Nick Samoylov
Author Profile Icon Nick Samoylov
Nick Samoylov
Thomas Nield Thomas Nield
Author Profile Icon Thomas Nield
Thomas Nield
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Section 1: Foundations of Reactive Programming in Java
2. Thinking Reactively FREE CHAPTER 3. Observable and Observer 4. Basic Operators 5. Section 2: Reactive Operators
6. Combining Observables 7. Multicasting, Replaying, and Caching 8. Concurrency and Parallelization 9. Switching, Throttling, Windowing, and Buffering 10. Flowable and Backpressure 11. Transformers and Custom Operators 12. Section 3: Integration of RxJava applications
13. Testing and Debugging 14. RxJava on Android 15. Using RxJava for Kotlin 16. Other Books You May Enjoy Appendix A: Introducing Lambda Expressions 1. Appendix B: Functional Types 2. Appendix C: Mixing Object-Oriented and Reactive Programming 3. Appendix D: Materializing and Dematerializing 4. Appendix E: Understanding Schedulers

Disposing

When you call subscribe() to an Observable to receive emissions, a stream is created to process those emissions through the Observable chain. Of course, this uses resources. When we are done, we want to dispose of these resources so that they can be garbage-collected.

Thankfully, the finite Observable that calls onComplete() will typically dispose of itself safely when all items are emitted. But if you are working with an infinite or long-running Observable, you likely will run into situations where you want to explicitly stop the emissions and dispose of everything associated with that subscription. As a matter of fact, you cannot trust the garbage collector to take care of active subscriptions that you no longer need, and explicit disposal is necessary in order to prevent memory leaks.

Disposable is a link between an Observable and an active Observer. You can call...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at R$50/month. Cancel anytime