0

I want to perform SQLite database backups/restores. I thought the easiest way was to use the BackUp API. However, the documentation says:

However, reading and writing to files on internal storage is not threadsafe. To ensure that your backup agent does not read or write your files at the same time as your activities, you must use synchronized statements each time you perform a read or write. For example, in any Activity where you read and write the file, you need an object to use as the intrinsic lock for the synchronized statements:

How can I perform database backups/restore thread safe?

Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
  • As far as you make sure to not make more than one backup at the same time you don't need to make it thread safe (supposing there is not any other process on that backup file that could access it) – tru7 Aug 31 '16 at 19:05
  • How about a backup and an user performing a write action? – Robin Dijkhof Aug 31 '16 at 19:07

0 Answers0