Why introduce this bottleneck?
I don't exactly agree to this. Creating a lock till the transaction completes is in itself a bottleneck. Even through we have multiple threads runnning, none will be processing till the lock is released. I don't understand how this is any different from synchronisation.
More than one (or other clients) and the issue returns.
You are totally right on this
. Synchronisation does not handle this.
The reason I suggested this is - if we keep a transaction lock, all the remaining threads will open a connection and wait for the query to execute after the lock is released. Based on the number of threads, this can pile up a number of connections that puts load on the database. This, of course, depends on the implementation of the logic.
Also, I think that in some cases (may be in some databases) creating a lock on the transaction, may cause other transactions to throw an SQLException. Correct me if I am wrong.