jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edgarp...@apache.org
Subject svn commit: r414703 - /jackrabbit/trunk/jca/src/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
Date Thu, 15 Jun 2006 23:16:57 GMT
Author: edgarpoce
Date: Thu Jun 15 16:16:56 2006
New Revision: 414703

URL: http://svn.apache.org/viewvc?rev=414703&view=rev
Log:
JCR-412 JCA Concurrent Modification Exception when JCAManagedConnection.cleanup() called
JCR-461 ManagedConnection#cleanup doesn't refresh the session

Modified:
    jackrabbit/trunk/jca/src/java/org/apache/jackrabbit/jca/JCAManagedConnection.java

Modified: jackrabbit/trunk/jca/src/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jca/src/java/org/apache/jackrabbit/jca/JCAManagedConnection.java?rev=414703&r1=414702&r2=414703&view=diff
==============================================================================
--- jackrabbit/trunk/jca/src/java/org/apache/jackrabbit/jca/JCAManagedConnection.java (original)
+++ jackrabbit/trunk/jca/src/java/org/apache/jackrabbit/jca/JCAManagedConnection.java Thu
Jun 15 16:16:56 2006
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.core.XASession;
 
 import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionEvent;
 import javax.resource.spi.ConnectionEventListener;
@@ -143,7 +144,14 @@
      */
     public void cleanup()
             throws ResourceException {
-        closeHandles();
+        synchronized (handles) {
+            try {
+                this.session.refresh(false);
+            } catch (RepositoryException e) {
+                throw new ResourceException("unable to cleanup connection", e);
+            }
+            this.handles.clear();
+        }
     }
 
     /**
@@ -379,12 +387,12 @@
      */
     private void closeHandles() {
         synchronized (handles) {
-            for (Iterator i = handles.iterator(); i.hasNext();) {
-                JCASessionHandle handle = (JCASessionHandle) i.next();
-                closeHandle(handle);
+            JCASessionHandle[] handlesArray = new JCASessionHandle[handles
+                    .size()];
+            handles.toArray(handlesArray);
+            for (int i = 0; i < handlesArray.length; i++) {
+                this.closeHandle(handlesArray[i]);
             }
-
-            handles.clear();
         }
     }
 }



Mime
View raw message