db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r385569 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql: compile/CompilerContextImpl.java conn/GenericLanguageConnectionContext.java
Date Mon, 13 Mar 2006 15:15:54 GMT
Author: djd
Date: Mon Mar 13 07:15:51 2006
New Revision: 385569

URL: http://svn.apache.org/viewcvs?rev=385569&view=rev
Log:
DERBY-1095 (partial) Ensure StatementContexts and CompilerContexts are popped from
context manager on a session close.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java?rev=385569&r1=385568&r2=385569&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
Mon Mar 13 07:15:51 2006
@@ -113,8 +113,10 @@
 			// REVISIT: do we want instead to remove it,
 			// so the cache doesn't get full of garbage input
 			// that won't even parse?
+            
+            int severity = se.getSeverity();
 
-			if (se.getSeverity() < ExceptionSeverity.SYSTEM_SEVERITY) 
+			if (severity < ExceptionSeverity.SYSTEM_SEVERITY) 
 			{
 				if (currentDependent != null)
 				{
@@ -126,6 +128,9 @@
 			}
 			// anything system or worse, or non-DB errors,
 			// will cause the whole system to shut down.
+            
+            if (severity >= ExceptionSeverity.SESSION_SEVERITY)
+                popMe();
 		}
 
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?rev=385569&r1=385568&r2=385569&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Mon Mar 13 07:15:51 2006
@@ -181,8 +181,8 @@
 	 * invocation, though we still push and pop it as needed.  All other
      * statement contexts will allocated and pushed and popped on demand.
      */
-	protected StatementContext[] statementContexts = new StatementContext[2];
-	protected int     statementDepth;
+	private final StatementContext[] statementContexts = new StatementContext[2];
+	private int     statementDepth;
 	protected int	  outermostTrigger = -1;
 
     protected Authorizer authorizer;
@@ -2037,9 +2037,14 @@
 				if (statementDepth <= 0)
 					SanityManager.THROWASSERT(
 						"statement depth expected to be >0, was "+statementDepth);
+                
+                if (getContextManager().getContext(statementContext.getIdName()) != statementContext)
+                {
+                    SanityManager.THROWASSERT("trying to pop statement context from middle
of stack");
+                }
 			}
 
-			getContextManager().getContext(org.apache.derby.iapi.reference.ContextId.LANG_STATEMENT).popMe();
	
+            statementContext.popMe();		
 		}
 
 	}
@@ -2615,16 +2620,23 @@
 		if (statementContexts[0] != null)
 		{
 			statementContexts[0].clearInUse();
+            
+            // Force the StatementContext that's normally
+            // left on the stack for optimization to be popped
+            // when the session is closed. Ensures full cleanup
+            // and no hanging refrences in the ContextManager.
+            if (severity >= ExceptionSeverity.SESSION_SEVERITY)
+                statementContexts[0].popMe();
 		}
 		if (statementContexts[1] != null)
 		{
-			statementContexts[1].clearInUse();
+			statementContexts[1].clearInUse();                
 		}
 
 		// closing the activations closes all the open cursors.
 		// the activations are, for all intents and purposes, the
 		// cursors.
-		if (severity == ExceptionSeverity.SESSION_SEVERITY) 
+		if (severity >= ExceptionSeverity.SESSION_SEVERITY) 
 		{
 			for (int i = acts.size() - 1; i >= 0; i--) {
 				// it maybe the case that a reset()/close() ends up closing
@@ -2636,11 +2648,7 @@
 				a.reset();
 				a.close();
 			}
-			popMe();
-		}
-
-		else if (severity > ExceptionSeverity.SESSION_SEVERITY)
-		{
+                       
 			popMe();
 		}
 



Mime
View raw message