jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marti...@apache.org
Subject svn commit: r813365 - in /jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: data/db/DbDataStore.java util/db/DbUtility.java
Date Thu, 10 Sep 2009 11:07:20 GMT
Author: martijnh
Date: Thu Sep 10 11:07:20 2009
New Revision: 813365

URL: http://svn.apache.org/viewvc?rev=813365&view=rev
Log:
JCR 1456 Database connection pooling

* Prevent closing database resources twice.

Modified:
    jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
    jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/DbUtility.java

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java?rev=813365&r1=813364&r2=813365&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
(original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
Thu Sep 10 11:07:20 2009
@@ -357,6 +357,7 @@
             int count = conHelper.update(updateSQL, new Object[]{
                     id, new Long(length), new Long(now),
                     tempId, id});
+            rs = null; // prevent that rs.close() is called in finally block if count !=
0 (rs is closed above)
             if (count == 0) {
                 // update count is 0, meaning such a row already exists
                 // DELETE FROM DATASTORE WHERE ID=?

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/DbUtility.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/DbUtility.java?rev=813365&r1=813364&r2=813365&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/DbUtility.java
(original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/DbUtility.java
Thu Sep 10 11:07:20 2009
@@ -57,11 +57,11 @@
      */
     public static void close(Connection con, Statement stmt, ResultSet rs) {
         try {
-            if (con != null) {
-                con.close();
+            if (rs != null) {
+                rs.close();
             }
         } catch (SQLException e) {
-            logException("failed to close Connection", e);
+            logException("failed to close ResultSet", e);
         } finally {
             try {
                 if (stmt != null) {
@@ -71,11 +71,11 @@
                 logException("failed to close Statement", e);
             } finally {
                 try {
-                    if (rs != null) {
-                        rs.close();
+                    if (con != null) {
+                        con.close();
                     }
                 } catch (SQLException e) {
-                    logException("failed to close ResultSet", e);
+                    logException("failed to close Connection", e);
                 }
             }
         }



Mime
View raw message