Invalidation Tracking and Processes

InvalidationTracker is an ordinary Java class. So are RoomDatabase and the code-generated bits that we get from the Room compiler. They are part of the memory of whatever process that you used to create an instance of your RoomDatabase subclass.

If you have two processes, each working with the same RoomDatabase subclass, each process will have its own independent instance of that subclass, and each of those will be associated with its own InvalidationTracker. Each of those instances will know nothing about the other.

If you modify the database in one process, the InvalidationTracker of that process can notify observers in that process about updated results to their queries. However, by default, the InvalidationTracker of the other process will not find out about the database modifications and will not be able to update its own observers with fresh data.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.