You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/03/24 21:23:00 UTC
svn commit: r388626 - in
/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context:
ContextManager.java ContextService.java
Author: djd
Date: Fri Mar 24 12:22:56 2006
New Revision: 388626
URL: http://svn.apache.org/viewcvs?rev=388626&view=rev
Log:
DERBY-1095 (partial) Once a ContextManager is empty no longer maintain a reference
to it in the thread local variable. Avoids a thread hanging onto memory for ever.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java?rev=388626&r1=388625&r2=388626&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java Fri Mar 24 12:22:56 2006
@@ -203,6 +203,14 @@
// now remove it from its id's stack.
idStack.remove(theContext);
}
+
+ /**
+ * Is the ContextManager empty containing no Contexts.
+ */
+ final boolean isEmpty()
+ {
+ return holder.isEmpty();
+ }
/**
* Return an unmodifiable list reference to the ArrayList backing
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java?rev=388626&r1=388625&r2=388626&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java Fri Mar 24 12:22:56 2006
@@ -326,8 +326,21 @@
}
if (cm.activeCount != -1) {
- if (--cm.activeCount == 0)
+ if (--cm.activeCount == 0) {
cm.activeThread = null;
+
+ // If the ContextManager is empty
+ // then don't keep a reference to it
+ // when it is not in use. The ContextManager
+ // has been closed (most likely) and this
+ // is now unwanted. Keeping the reference
+ // would hold onto memory and increase the
+ // chance of holding onto a another reference
+ // will could cause issues for future operations.
+ if (cm.isEmpty())
+ tcl.set(null);
+
+ }
return;
}