I have a really long running transaction in background thread which...
- iterates through around batches of 400 records
- checks if it exists
- update if it exists, create new otherwise
- iterate through all of them again, to do some operation
and number of batches may vary.
The problem is: as long as the transaction is running, I cannot access database. I'm using a single instance of SQLiteOpenHelper to access database throughout application.
I've tried yieldIfContendedSafely() method, but it doesn't seem to work (or am I using it incorrectly?)
If I try to access database when the transaction is running, it does not throw any exception. It just sits there, like in a queue, and runs immediately when transaction ends.
PS: It is safe to access the database in this scenario, since transaction is running on one table, and I'm trying to read another table.
Aucun commentaire:
Enregistrer un commentaire