Architecture-components-samples: Question: Does Room support multithreaded insert (and is it thread-safe if not)?

Created on 13 Jun 2017  路  2Comments  路  Source: android/architecture-components-samples

Essentially, does Room support multithreaded insert, or is it atleast internally synchronized, so I don't run into some kind of Concurrent Modification exception?

I see that you use a single-thread Executor for IO in the samples, so is it necessary, or Room takes care of it itself?

Thanks!

Most helpful comment

Database takes care of itself so you should not need to worry. Room creates a transaction for each modification automatically. You need to be careful though not to deadlock yourself with your other threads.

All 2 comments

Database takes care of itself so you should not need to worry. Room creates a transaction for each modification automatically. You need to be careful though not to deadlock yourself with your other threads.

Nice question & Nice ROOM

Was this page helpful?
0 / 5 - 0 ratings