jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r393452 - /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
Date Wed, 12 Apr 2006 13:02:32 GMT
Author: tripod
Date: Wed Apr 12 06:02:30 2006
New Revision: 393452

URL: http://svn.apache.org/viewcvs?rev=393452&view=rev
Log:
[JCR-395] Using transactions leads to memory leak

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java?rev=393452&r1=393451&r2=393452&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
Wed Apr 12 06:02:30 2006
@@ -37,6 +37,7 @@
 import javax.transaction.xa.Xid;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Collections;
 
 /**
  * Session extension that provides XA support.
@@ -52,7 +53,7 @@
     /**
      * Global transactions
      */
-    private static final Map txGlobal = new HashMap();
+    private static final Map txGlobal = Collections.synchronizedMap(new HashMap());
 
     /**
      * Default transaction timeout, in seconds.
@@ -290,7 +291,10 @@
         if (tx == null) {
             throw new XAException(XAException.XAER_NOTA);
         }
-        if (flags == TMSUCCESS || flags == TMFAIL || flags == TMSUSPEND) {
+        if (flags == TMSUCCESS || flags == TMFAIL) {
+            associate(null);
+            txGlobal.remove(xid);
+        } else if (flags == TMSUSPEND) {
             associate(null);
         } else {
             throw new XAException(XAException.XAER_INVAL);



Mime
View raw message