From bd317c66d2d505d112e405401ad4cc3a1f83cd0b Mon Sep 17 00:00:00 2001 From: Ondro Mihalyi Date: Fri, 6 Sep 2024 03:16:32 +0200 Subject: [PATCH 1/2] 24805: Do not unenlist XA transactions if related to the current Tx --- .../java/com/sun/enterprise/resource/pool/PoolTxHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolTxHelper.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolTxHelper.java index 4b66f2ca461..8cace2588f9 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolTxHelper.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolTxHelper.java @@ -116,15 +116,15 @@ public boolean isLocalTransactionInProgress() { /** * Check whether the local resource in question is the one participating in transaction. * - * @param h ResourceHandle + * @param handle ResourceHandle * @return true if the resource is participating in the transaction */ - public boolean isLocalResourceInTransaction(ResourceHandle h) { + private boolean isLocalResourceInTransaction(ResourceHandle handle) { boolean result = true; try { JavaEETransaction txn = (JavaEETransaction) ConnectorRuntime.getRuntime().getTransaction(); if (txn != null) { - result = isNonXAResourceInTransaction(txn, h); + result = isNonXAResourceInTransaction(txn, handle) && txn.getResources(poolInfo).contains(handle); } } catch (SystemException e) { if (_logger.isLoggable(Level.FINE)) { From f502ea24caad44e4df7e12a95fcf0dcd6702b3ac Mon Sep 17 00:00:00 2001 From: Ondro Mihalyi Date: Thu, 12 Sep 2024 14:20:39 +0200 Subject: [PATCH 2/2] 24805: Fix of logical operator Resource is in Tx if it's the non-XA resource attached to the Tx OR if it's attached to the poolInto that is attached to the Tx. Maybe it's enough to keep only the second condition, it seems that non-XA resources are also in the poolInfo but not sure. --- .../java/com/sun/enterprise/resource/pool/PoolTxHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolTxHelper.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolTxHelper.java index 8cace2588f9..3ab9c05c6e9 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolTxHelper.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolTxHelper.java @@ -124,7 +124,7 @@ private boolean isLocalResourceInTransaction(ResourceHandle handle) { try { JavaEETransaction txn = (JavaEETransaction) ConnectorRuntime.getRuntime().getTransaction(); if (txn != null) { - result = isNonXAResourceInTransaction(txn, handle) && txn.getResources(poolInfo).contains(handle); + result = isNonXAResourceInTransaction(txn, handle) || txn.getResources(poolInfo).contains(handle); } } catch (SystemException e) { if (_logger.isLoggable(Level.FINE)) {