Explicit Transactions on Reads

Concurrent BDB XML applications should take care to use explicit transactions for read-only activity in the container, as well as write-only and read/write container activity. You should not perform reads without the benefit of an explicit transaction handle in BDB XML if you are using multiple threads to access the container, and you are using transactions in the first place.

The reason for this is that read operations take locks and can still deadlock. Therefore, non-transactional reads that occur concurrently with transactional operations (read or write) will lead to hangs and/or unexpected exceptions.

In addition, your threads that perform container access should always perform deadlock handling, even if the thread only ever performs read-only access. The exception to this rule for read-only threads is if you are using snapshot isolation. In that case, your application should not see deadlocks.

For information on handling deadlocks, see The Locking Subsystem. For information on using snapshot isolation, see Using Snapshot Isolation.