Skip to main content



      Home
Home » Eclipse Projects » Eclipse Project for JTA » TransactionSynchronizationRegistry.registerInterposedSynchronization() when marked for rollback(Clarification on spec for TransactionSynchronizationRegistry when marked for rollback)
TransactionSynchronizationRegistry.registerInterposedSynchronization() when marked for rollback [message #1845117] Thu, 07 October 2021 12:35 Go to next message
Eclipse UserFriend
Most methods of TransactionSynchronizationRegistry throw an IllegalStateException "if no transaction is active", most notably : TransactionSynchronizationRegistry.registerInterposedSynchronization()

Does "if no transaction is active" mean
a) if no transaction is present on the current thread
b) if no transaction in state ACTIVE is present on the current thread
(or something entirely different)?

More concrete: how should registerInterposedSynchronization() behave in case current transaction is marked for rollback? Should it reject the action with an IllegalStateException or accept the registered synchronization and execute afterCompletion() when the rollback actually happens?

For reference: I'm asking because of the discussion on WFLY-15377

[Updated on: Fri, 08 October 2021 03:30] by Moderator

Re: TransactionSynchronizationRegistry.registerInterposedSynchronization() when marked for rollback [message #1847063 is a reply to message #1845117] Wed, 13 October 2021 08:08 Go to previous message
Eclipse UserFriend
The JTA 1.1 version of the specification has improved the wording in this area. In the section with the title "Interface TransactionSynchronizationRegistry` where it describes the registerInterposedSynchronization method (at the bottom of page 46) it says:

"If this method is invoked without an active transaction context, an IllegalStateException is thrown."

and then it says what exceptions are thrown:

" Throws: IllegalStateException
Thrown if the current thread is not associated with a transaction."

which implies that "without an active transaction context" has the same meaning as "the current thread is not associated with a transaction". In other words the "active transaction context" is whatever transaction is currently associated with the calling thread.
Goto Forum:
  


Current Time: Wed May 07 22:00:35 EDT 2025

Powered by FUDForum. Page generated in 0.24667 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top