Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

InvalidationTracker

open class InvalidationTracker
kotlin.Any
   ↳ androidx.room.InvalidationTracker

InvalidationTracker keeps a list of tables modified by queries and notifies its callbacks about these tables.

Summary

Nested classes
abstract

An observer that can listen for changes in the database.

Public methods
open Unit

Adds the given observer to the observers list and it will be notified if any table it observes changes.

open Unit

Enqueues a task to refresh the list of updated tables.

open Unit

Removes the observer from the observers list.

Public methods

addObserver

@WorkerThread open fun addObserver(@NonNull observer: InvalidationTracker.Observer): Unit

Adds the given observer to the observers list and it will be notified if any table it observes changes.

Database changes are pulled on another thread so in some race conditions, the observer might be invoked for changes that were done before it is added.

If the observer already exists, this is a no-op call.

If one of the tables in the Observer does not exist in the database, this method throws an IllegalArgumentException.

Parameters
observer InvalidationTracker.Observer: The observer which listens the database for changes.

refreshVersionsAsync

open fun refreshVersionsAsync(): Unit

Enqueues a task to refresh the list of updated tables.

This method is automatically called when RoomDatabase#endTransaction() is called but if you have another connection to the database or directly use , you may need to call this manually.

removeObserver

@WorkerThread open fun removeObserver(@NonNull observer: InvalidationTracker.Observer): Unit

Removes the observer from the observers list.

Parameters
observer InvalidationTracker.Observer: The observer to remove.