You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Jonathan Gallimore <jo...@gmail.com> on 2019/07/04 21:09:30 UTC

ManagedConnection weirdness with XA

Hi folks

Just wanted to give you a heads up on a changed I have push to
ManagedConnection / ManagedDataSource / ManagedXADataSource.

There's a case where, particularly if you're using XA, if you use a second
connection to the same datasource in the same transaction,
ManagedConnection will fetch the delegate transaction from the transaction
registry, but the xaConnection and xaResource fields are dropped.

The change I have made is to associate store the actual connection (where
we have ManagedConnection as the InvocationHandler) in the transaction
registry instead, and use that we getting a connection from
ManagedDataSource/ManagedXADataSource, or restoring all of delegate,
xaConnection, xaResource if the second connection is created outside the
transaction and then enlisted in it.

The actual change is here:
https://github.com/apache/tomee/commit/64d3ce583ce92c0d33975fcedbd0d4e079b63798

I've extended ManagedConnectionBehaviourTest in another commit:
https://github.com/apache/tomee/commit/b6d92c0378503de776c66df6675374db0091aa08

I'll work on an Arquillian test as well, but any feedback is welcome.

JIRA is: https://issues.apache.org/jira/browse/TOMEE-2561

Cheers
Jon

Re: ManagedConnection weirdness with XA

Posted by Jean-Louis Monteiro <jl...@tomitribe.com>.
Weird situation but good catch.
The datasource code is overall very complex.
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Thu, Jul 4, 2019 at 11:09 PM Jonathan Gallimore <
jonathan.gallimore@gmail.com> wrote:

> Hi folks
>
> Just wanted to give you a heads up on a changed I have push to
> ManagedConnection / ManagedDataSource / ManagedXADataSource.
>
> There's a case where, particularly if you're using XA, if you use a second
> connection to the same datasource in the same transaction,
> ManagedConnection will fetch the delegate transaction from the transaction
> registry, but the xaConnection and xaResource fields are dropped.
>
> The change I have made is to associate store the actual connection (where
> we have ManagedConnection as the InvocationHandler) in the transaction
> registry instead, and use that we getting a connection from
> ManagedDataSource/ManagedXADataSource, or restoring all of delegate,
> xaConnection, xaResource if the second connection is created outside the
> transaction and then enlisted in it.
>
> The actual change is here:
>
> https://github.com/apache/tomee/commit/64d3ce583ce92c0d33975fcedbd0d4e079b63798
>
> I've extended ManagedConnectionBehaviourTest in another commit:
>
> https://github.com/apache/tomee/commit/b6d92c0378503de776c66df6675374db0091aa08
>
> I'll work on an Arquillian test as well, but any feedback is welcome.
>
> JIRA is: https://issues.apache.org/jira/browse/TOMEE-2561
>
> Cheers
> Jon
>