db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r420656 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc: EmbedResultSet.java EmbedStatement.java
Date Mon, 10 Jul 2006 23:12:32 GMT
Author: djd
Date: Mon Jul 10 16:12:31 2006
New Revision: 420656

URL: http://svn.apache.org/viewvc?rev=420656&view=rev
Log:
DERBY-1142 (partial) Make EmbedResultSet close its activation in the close method when it
is
single use ResultSet (e.g. from a Statement.executeQuery()). Otherwise the close of the activation
would be delayed until the EmbedResultSet was garbage collected and subsequent activity on
the connection.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?rev=420656&r1=420655&r2=420656&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Mon Jul
10 16:12:31 2006
@@ -126,13 +126,16 @@
 	private ResultSetMetaData rMetaData;
 	private SQLWarning topWarning;
 
-	// This activation is set by EmbedStatement
-	// for a single execution Activation. Ie.
-	// a ResultSet from a Statement.executeQuery().
-	// In this case the finalization of the ResultSet
-	// will mark the Activation as unused.
-	// c.f. EmbedPreparedStatement.finalize().
-	Activation finalizeActivation;
+	/**
+	 This activation is set by EmbedStatement
+	 for a single execution Activation. Ie.
+	 a ResultSet from a Statement.executeQuery().
+	 In this case the closing of this ResultSet will close
+	 the activation or the finalization of the ResultSet
+	 without it being closed will mark the Activation as unused.
+	 c.f. EmbedPreparedStatement.finalize().
+    */
+	Activation singleUseActivation;
 
 	// Order of creation 
 	final int order;
@@ -230,7 +233,8 @@
 		//CONCUR_READ_ONLY or CONCUR_UPDATABLE depending on whether the underlying language resultset
is updateable or not.
 		//If the underlying language resultset is not updateable, then the concurrency of the ResultSet
object will be CONCUR_READ_ONLY
 		//and a warning will be issued on the ResultSet object.
-		if (stmt == null) concurrencyOfThisResultSet = JDBC20Translation.CONCUR_READ_ONLY;
+		if (stmt == null)
+			concurrencyOfThisResultSet = JDBC20Translation.CONCUR_READ_ONLY;
 		else if (stmt.getResultSetConcurrency() == JDBC20Translation.CONCUR_READ_ONLY)
 			concurrencyOfThisResultSet = JDBC20Translation.CONCUR_READ_ONLY;
 		else {
@@ -294,8 +298,8 @@
 	protected void finalize() throws Throwable {
 		super.finalize();
 
-		if (finalizeActivation != null) {
-			finalizeActivation.markUnused();
+		if (singleUseActivation != null) {
+			singleUseActivation.markUnused();
 		}		
 	}
 
@@ -578,7 +582,14 @@
 
 			try	{
 				try	{
-				    theResults.finish(); // release the result set, don't just close it
+					theResults.finish(); // release the result set, don't just close it
+				    
+				    if (this.singleUseActivation != null)
+				    {
+				    	this.singleUseActivation.close();
+				    	this.singleUseActivation = null;
+				    }
+				    
 				} catch (Throwable t) {
 					throw handleException(t);
 				}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java?rev=420656&r1=420655&r2=420656&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java Mon Jul
10 16:12:31 2006
@@ -1202,7 +1202,7 @@
 					// closed sometime later by the connection
 					// outside of finalization.
 					if (a.isSingleExecution())
-						lresults.finalizeActivation = a;
+						lresults.singleUseActivation = a;
 
 					updateCount = -1;
 					retval = true;



Mime
View raw message