db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1338068 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java
Date Mon, 14 May 2012 08:52:32 GMT
Author: kristwaa
Date: Mon May 14 08:52:32 2012
New Revision: 1338068

URL: http://svn.apache.org/viewvc?rev=1338068&view=rev
Log:
DERBY-5759: Add IndexStatsUtil.release(boolean closeConnection)

Made it possible to clean up the resources used by the utility without
closing the connection.

Patch file: derby-5759-1a-release_with_arg.diff

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java?rev=1338068&r1=1338067&r2=1338068&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/IndexStatsUtil.java Mon
May 14 08:52:32 2012
@@ -410,9 +410,18 @@ public class IndexStatsUtil {
     }
 
     /**
-     * Releases resources.
+     * Releases resources and closes the associated connection.
      */
     public void release() {
+        release(true);
+    }
+
+    /**
+     * Releases resources.
+     *
+     * @param closeConnection whether to close the associated connection
+     */
+    public void release(boolean closeConnection) {
         PreparedStatement[] psToClose = new PreparedStatement[] {
             psGetStats, psGetIndexId, psGetStatsForIndex,
             psGetStatsForTable, psGetTableId,
@@ -431,7 +440,9 @@ public class IndexStatsUtil {
             if (!con.isClosed()) {
                 con.rollback();
             }
-            con.close();
+            if (closeConnection) {
+                con.close();
+            }
         } catch (SQLException sqle) {
             // Ignore
         }



Mime
View raw message