How rollback transaction after timeout in spring boot application in same way as on weblogic How rollback transaction after timeout in spring boot application in same way as on weblogic spring spring

How rollback transaction after timeout in spring boot application in same way as on weblogic


set com.atomikos.icatch.threaded_2pc=true in jta.properties fixed my problem. Idk why this default value was change to false in web application.

 * @param single_threaded_2pc (!com.atomikos.icatch.threaded_2pc) *           If true then commit is done in the same thread as the one that *            started the tx.


XA transactions are horribly complicated and you really want to have a very good reason for using them (ie it's literally impossible to add some business process that removes the need for XA), because you are going to get into trouble out in the wild...

That said, My guess is that it's about timeout discrepancies between XA phases.

With XA there are 2 timeouts - a timeout for the 1st phase, known as the Voting phase (which is typically the one set by the @Transactional annotation, but this depends on the JTA provider) and another timeout for the 2nd phase, known as the commit phase, which is typically a lot longer, because the Transaction Manager has already got the agreement from all parties that the commit is ready to go, and therefore provide greater leeway for things like transient network failures and so on.

My guess is that the WebLogic JTA is simply behaving differently to Atomikos with how it's handling the 2nd phase notifications back from the participants, until atomikos is changed to use the multithreaded ack.

If you application is just you and the database, then you can probably get away without an XA Transaction Manager. I'd expect this would behave the way you want for timeouts.

Good Luck!