You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mini B (Jira)" <ji...@apache.org> on 2022/05/31 03:47:00 UTC
[jira] [Commented] (TRANSACTION-34) Connection handle is not set in MapManagedConnection.close()
[ https://issues.apache.org/jira/browse/TRANSACTION-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17544114#comment-17544114 ]
Mini B commented on TRANSACTION-34:
-----------------------------------
We are observing connection leak when a database work is done on afterCompletion() of java transaction, this ticket seems to related.
> Connection handle is not set in MapManagedConnection.close()
> ------------------------------------------------------------
>
> Key: TRANSACTION-34
> URL: https://issues.apache.org/jira/browse/TRANSACTION-34
> Project: Commons Transaction
> Issue Type: Bug
> Affects Versions: 1.2
> Environment: all
> Reporter: Boris Kobilkovsky
> Priority: Minor
>
> Setting a connection handle on close is an explicit requirement of JTA spec. Not setting the handle leads to memory leaks and incorrect connection state in transaction managers.
> The fix is trivial. Below is the fixed correct implementation of org.apache.commons.transaction.memory.jca.MapManagedConnection.close()
> public void close() {
> ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
> //the fix start
> event.setConnectionHandle(connection);
> ///the fix end
> for (Iterator it = listeners.iterator(); it.hasNext();) {
> ((ConnectionEventListener) it.next()).connectionClosed(event);
> }
> connection.invalidate();
> connection = null;
> }
--
This message was sent by Atlassian Jira
(v8.20.7#820007)