Skip to content

XAResource needs ordering guarantees for setReadOnly#244

Open
njr-11 wants to merge 1 commit intojakartaee:masterfrom
njr-11:220-xaresource-needs-ordering-guarantee-for-setreadonly
Open

XAResource needs ordering guarantees for setReadOnly#244
njr-11 wants to merge 1 commit intojakartaee:masterfrom
njr-11:220-xaresource-needs-ordering-guarantee-for-setreadonly

Conversation

@njr-11
Copy link
Member

@njr-11 njr-11 commented Oct 22, 2025

While continuing to review the Transactions read-only feature for integration with the Jakarta Connector spec, I noticed a problem for XAResource/ExtendedXAResource implementations, which need more information about when they will need to handle setReadOnly(xid) being invoked. This matters to the XAResource because some implementations will not be capable of changing the read-only behavior after the transaction has started. See the Connection.setReadOnly method of JDBC, which explicitly forbids changing read-only after a transaction has started. ExtendedXAResource.setReadOnly should provide guarantees that it can only be validly invoked prior to XAResource.start so that the XAResource can know before starting the transaction what the read-only will be and will never need to handle it changing during the transaction. I proposed a few sentences in the Javadoc to cover this.

@jta-bot
Copy link
Contributor

jta-bot commented Oct 22, 2025

Can one of the admins verify this patch?

@tomjenkinson
Copy link
Contributor

OK to test

@tomjenkinson
Copy link
Contributor

@beikov - please can I ask you to review this too? It looks good to me but I think we should have a TCK test to verify it. @njr-11 I can help with the TCK if you like, or you could try to build on what @beikov provided before. It should be feasible to extend the XAResourceImpl (https://github.com/jakartaee/platform-tck/pull/2163/files#diff-9c52739a364cbdb85f1b41362ca714de2cecc5c06a95383e467f587bf2e18420R32) to check that start is called first

@beikov
Copy link
Contributor

beikov commented Oct 23, 2025

LGTM

@njr-11
Copy link
Member Author

njr-11 commented Oct 23, 2025

we should have a TCK test to verify it. @njr-11 I can help with the TCK if you like, or you could try to build on what @beikov provided before. It should be feasible to extend the XAResourceImpl (https://github.com/jakartaee/platform-tck/pull/2163/files#diff-9c52739a364cbdb85f1b41362ca714de2cecc5c06a95383e467f587bf2e18420R32) to check that start is called first

@tomjenkinson that would be great if you add the TCK test. Thanks! My familiarity with Jakarta Transactions is limited to how it is used by other Jakarta specifications that I work on.

@tomjenkinson
Copy link
Contributor

tomjenkinson commented Oct 23, 2025

Certainly that's possible, but I will ask on jta-dev if we have any volunteers first. Thank you for the contribution!

@tomjenkinson
Copy link
Contributor

tomjenkinson commented Oct 23, 2025

FYI I have requested for volunteers over at https://www.eclipse.org/lists/jta-dev/msg00378.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants