Skip to content

Commit 19b080b

Browse files
committed
Clarify JMS sessionTransacted flag for local versus global transaction
Closes gh-35897 (cherry picked from commit 9d4abb6)
1 parent f9b4fba commit 19b080b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,18 @@ protected final ConnectionFactory obtainConnectionFactory() {
102102
/**
103103
* Set the transaction mode that is used when creating a JMS {@link Session}.
104104
* Default is "false".
105-
* <p>Note that within a JTA transaction, the parameters passed to
106-
* {@code create(Queue/Topic)Session(boolean transacted, int acknowledgeMode)}
107-
* method are not taken into account. Depending on the Jakarta EE transaction context,
108-
* the container makes its own decisions on these values. Analogously, these
109-
* parameters are not taken into account within a locally managed transaction
110-
* either, since the accessor operates on an existing JMS Session in this case.
111105
* <p>Setting this flag to "true" will use a short local JMS transaction
112106
* when running outside a managed transaction, and a synchronized local
113107
* JMS transaction in case of a managed transaction (other than an XA
114108
* transaction) being present. This has the effect of a local JMS
115109
* transaction being managed alongside the main transaction (which might
116110
* be a native JDBC transaction), with the JMS transaction committing
117111
* right after the main transaction.
112+
* <p>Note that this flag is meant to remain at its default value "false" for
113+
* participating in a global JTA/XA transaction in a Jakarta EE environment.
114+
* While the server may leniently ignore local Session-level transaction
115+
* management in such a scenario, it may also throw unexpected exceptions
116+
* on commit/rollback in case of this Session-level flag being set to "true".
118117
* @see jakarta.jms.Connection#createSession(boolean, int)
119118
*/
120119
public void setSessionTransacted(boolean sessionTransacted) {

0 commit comments

Comments
 (0)