Feature190375 Allow recycling of active connections within the same transaction
You can now allow recycling of active JDBC/XA pooled connections within the same transaction, before they are "closed" by the application. This means that certain deadlock scenarios can be avoided.
Technical details
Imagine the following use case:
- start a JTA transaction
- get a JDBC/XA connection (c1) from the pool via getConnection()
- do some SQL on c1
- get a second JDBC/XA connection (c2) from the pool via getConnection()
Before this feature, step 4 would return a different physical connection from the pool. This would trigger a new XA branch, with unspecified isolation (locking) behaviour with respect to any updates performed via the connection in step 2. This could even cause deadlocks.
Therefore, people have asked us to allow for step 4 to reuse the same connection, c1. You can now enable this new behaviour by callingsetRecycleActiveConnectionsInTransaction(true)
on the AtomikosDataSourceBean
.
Changes impacting client API
A new, optional setter on our datasource. The default is false for backward compatibility.