From db6268a88839389e845532f7980b55f94a311465 Mon Sep 17 00:00:00 2001 From: "R.M.Morrien" Date: Mon, 11 Mar 2024 15:58:51 +0100 Subject: [PATCH] Fixes issue #24849 make relevant methods synchronized in LocalTxConnectionEventListener and protect associatedHandles from external clear calls. Process review comment and fix typo. --- .../com/sun/enterprise/resource/ConnectorXAResource.java | 8 ++------ .../resource/listener/LocalTxConnectionEventListener.java | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/ConnectorXAResource.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/ConnectorXAResource.java index 33f03c76093..b172bec0c6d 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/ConnectorXAResource.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/ConnectorXAResource.java @@ -124,9 +124,7 @@ public void end(Xid xid, int flags) throws XAException { if (handle != null) { // not needed, just to be sure. ManagedConnection associatedConnection = (ManagedConnection) handle.getResource(); associatedConnection.associateConnection(userHandle); - if (_logger.isLoggable(FINE)) { - _logger.log(FINE, "connection_sharing_reset_association", userHandle); - } + _logger.log(FINE, "connection_sharing_reset_association", userHandle); } } } catch (Exception e) { @@ -241,9 +239,7 @@ private void resetAssociation() throws XAException { ResourceHandle associatedHandle = (ResourceHandle) userHandleEntry.getValue(); ManagedConnection associatedConnection = (ManagedConnection) associatedHandle.getResource(); associatedConnection.associateConnection(userHandleEntry.getKey()); - if (_logger.isLoggable(FINE)) { - _logger.log(FINE, "connection_sharing_reset_association", userHandleEntry.getKey()); - } + _logger.log(FINE, "connection_sharing_reset_association", userHandleEntry.getKey()); } } catch (Exception ex) { handleResourceException(ex); diff --git a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java index 1b7185484bc..b9d09e3aaf9 100644 --- a/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java +++ b/appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java @@ -127,7 +127,7 @@ public synchronized void associateHandle(Object userHandle, ResourceHandle resou } /** - * Removes the Map entory for the given userHandle key. + * Removes the Map entry for the given userHandle key. * * @param userHandle The userHandle key to be removed from the map. * @return the associated ResourceHandle that is removed from the map or null if no association was found. A null return