2
votes

I watched the droidcon NYC 2017 speach of ObjectBox and there is one part in which Markus Junginger talks about transactions (around min 25).

The slide in this minute states:

No, we do not drop ACID: Transactions FTW!

  • ObjectBox is fully transactional (ACID)
  • Multi Version conurrency
    Multi concurrent readers (read TX)
    Single writer (write TX)
  • implicit transaction
    e.g. put(song), put(songList)

Does Single writer (write TX) mean that I cannot have 2 write transactions in parallel?

[edit]

I might have found the answer here

Write transactions are executed sequentially to ensure a consistent state. Thus, it is advised to keep write transactions short to avoid blocking other pending write transactions.

Still happy for any answers.

1

1 Answers

2
votes

You have found the correct documentation. Always one writer at a time. E.g. only a single runInTx (or put etc.) in progress at any time.

Update: Note that you do not have to worry about making write transactions sequential yourself. If multiple threads want to write at the same time (e.g. via put or runInTx), one of the treads will be selected to go first, while the other threads have to wait. It works just like a lock or synchronized in Java.