-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes erroneous closing behavior in JtaConnection.java #6321
Fixes erroneous closing behavior in JtaConnection.java #6321
Conversation
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
integrations/jta/jdbc/src/main/java/io/helidon/integrations/jta/jdbc/JtaConnection.java
Show resolved
Hide resolved
integrations/jta/jdbc/src/main/java/io/helidon/integrations/jta/jdbc/JtaConnection.java
Show resolved
Hide resolved
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
@tjquinno I've incorporated your suggestion to bake an explicit state model into |
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
@ljnelson Please add link to corresponding issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we encapsulate this in AtomicReference for the sake of readability?
Enlistment enlistment = new Enlistment(t, xar);
if (!ENLISTMENT.compareAndSet(this, null, enlistment)) { // atomic volatile write
// Setting this.enlistment could conceivably fail if another thread already enlisted this JtaConnection.
// That would be bad.
integrations/jta/jdbc/src/main/java/io/helidon/integrations/jta/jdbc/JtaConnection.java
Outdated
Show resolved
Hide resolved
I'd rather keep the speedy and efficient |
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it was work to use explicit states, but I think it's much clearer that way.
LGTM
* Fixes erroneous closing behavior in JtaConnection.java Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
* Improves integrations/jdbc/jdbc to better support future JPA improvements; initial work (#5654) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Squashable commit; initial work (#5716) Lays some groundwork with deprecation and cleanup and isolated improvements to support ongoing JPA improvements. Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Introduces LocalXAResource and a few support classes in jta/jdbc. (#5733) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Adds connection unwrapping abilities to CDISEPlatform.java (#5790) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Introduces JtaConnection.java (#5905) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Fixes erroneous closing behavior in JtaConnection.java (#6321) * Fixes erroneous closing behavior in JtaConnection.java Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Minor JPA cleanups; part of overall refactoring effort (#6435) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Improving JPA pom.xml as part of overall JPA refactoring (#6508) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Fixes merge conflicts etc. from cherry-pick of c9a849e Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Adds an enabled flag to JpaExtension to permit subsequent refactoring and replacement (#6512) Adds an enabled flag to JpaExtension to permit subsequent refactoring and replacement Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Adds more classes as part of overall JPA refactoring effort (#6584) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Lets unit tests validating JpaExtension and unit tests validating PersistenceExtension run side-by-side; continuation of overall fix for nested transaction problems (#7118) * Lets unit tests validating JpaExtension and unit tests validating PersistenceExtension run side-by-side; continuation of overall fix for nested transaction problems Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Resolves issue 7316, which features some intermittent database-related tests (#7317) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Addresses copyright plugin complaints after lots of cherry-picking from old 3.x commits Signed-off-by: Laird Nelson <laird.nelson@oracle.com> --------- Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
* Improves integrations/jdbc/jdbc to better support future JPA improvements; initial work (helidon-io#5654) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Squashable commit; initial work (helidon-io#5716) Lays some groundwork with deprecation and cleanup and isolated improvements to support ongoing JPA improvements. Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Introduces LocalXAResource and a few support classes in jta/jdbc. (helidon-io#5733) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Adds connection unwrapping abilities to CDISEPlatform.java (helidon-io#5790) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Introduces JtaConnection.java (helidon-io#5905) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Fixes erroneous closing behavior in JtaConnection.java (helidon-io#6321) * Fixes erroneous closing behavior in JtaConnection.java Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Minor JPA cleanups; part of overall refactoring effort (helidon-io#6435) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Improving JPA pom.xml as part of overall JPA refactoring (helidon-io#6508) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Fixes merge conflicts etc. from cherry-pick of c9a849e Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Adds an enabled flag to JpaExtension to permit subsequent refactoring and replacement (helidon-io#6512) Adds an enabled flag to JpaExtension to permit subsequent refactoring and replacement Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Adds more classes as part of overall JPA refactoring effort (helidon-io#6584) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Lets unit tests validating JpaExtension and unit tests validating PersistenceExtension run side-by-side; continuation of overall fix for nested transaction problems (helidon-io#7118) * Lets unit tests validating JpaExtension and unit tests validating PersistenceExtension run side-by-side; continuation of overall fix for nested transaction problems Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Resolves issue 7316, which features some intermittent database-related tests (helidon-io#7317) Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Addresses copyright plugin complaints after lots of cherry-picking from old 3.x commits Signed-off-by: Laird Nelson <laird.nelson@oracle.com> --------- Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
Consider the use case where a method is annotated with
jakarta.transaction.Transactional
andclose()
is called on aConnection
obtained therein.close()
in this case should not actually close theConnection
at that very moment, but closing should happen after the completion of the transaction. The prior version of this class was OK on the first point, and butchered the second point, so these changes fix the behavior. Note that theJtaConnection
class is not currently used in Helidon, but will be soon.