db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From be...@apache.org
Subject svn commit: r290644 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/services/context/ContextService.java impl/services/monitor/BaseMonitor.java impl/services/monitor/FileMonitor.java
Date Wed, 21 Sep 2005 07:24:38 GMT
Author: bernt
Date: Wed Sep 21 00:24:21 2005
New Revision: 290644

URL: http://svn.apache.org/viewcvs?rev=290644&view=rev
Log:
DERBY-23: just booting jdbc driver and shutting down seem to leak memory. Fix by : Knut Anders
Hatlen

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextService.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java

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=290644&r1=290643&r2=290644&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
Wed Sep 21 00:24:21 2005
@@ -94,9 +94,9 @@
 			STACK for last 3
 	*/
 
-	final ThreadLocal	threadContextList = new ThreadLocal();
+	private ThreadLocal threadContextList = new ThreadLocal();
 
-	private final HashSet allContexts;
+	private HashSet allContexts;
 
 	// don't want any instances
 	public ContextService() {
@@ -114,6 +114,12 @@
 		So it can be given to us and taken away...
 	 */
 	public static void stop() {
+		// For some unknown reason, the ContextManager and
+		// ContextService objects will not be garbage collected
+		// without the next two lines.
+		factory.allContexts = null;
+		factory.threadContextList = null;
+
 		ContextService.factory = null;
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java?rev=290644&r1=290643&r2=290644&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
Wed Sep 21 00:24:21 2005
@@ -2184,9 +2184,6 @@
 	}
 
 	public void run() {
-
-		goAway = false;
-
 		while (true) {
 			synchronized (this) {
 				if (goAway)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java?rev=290644&r1=290643&r2=290644&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
Wed Sep 21 00:24:21 2005
@@ -89,7 +89,12 @@
 	{
 		if (!lite) {
 			try {
+				// Create a ThreadGroup and set the daemon property to
+				// make sure the group is destroyed and garbage
+				// collected when all its members have finished (i.e.,
+				// when the driver is unloaded).
 				daemonGroup = new ThreadGroup("derby.daemons");
+				daemonGroup.setDaemon(true);
 			} catch (SecurityException se) {
 			}
 		}



Mime
View raw message