You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/06/18 12:37:22 UTC

svn commit: r548292 - /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java

Author: almaw
Date: Mon Jun 18 03:37:20 2007
New Revision: 548292

URL: http://svn.apache.org/viewvc?view=rev&rev=548292
Log:
WICKET-625 - Wicket doesn't clean up properly when hot-deploying; hangs onto Class references. (partial fix, work in progress)

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java?view=diff&rev=548292&r1=548291&r2=548292
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java Mon Jun 18 03:37:20 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.wicket.util.template;
 
+import java.lang.ref.WeakReference;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -57,7 +58,7 @@
 	/**
 	 * Shared resource scope
 	 */
-	private final Class scope;
+	private final WeakReference/*<Class>*/ scopeRef;
 
 	/**
 	 * Template to use to create resources
@@ -86,7 +87,7 @@
 	public TextTemplateSharedResourceFactory(final TextTemplate template, final Class scope)
 	{
 		this.template = template;
-		this.scope = scope;
+		this.scopeRef = new WeakReference(scope);
 	}
 
 	/**
@@ -130,7 +131,7 @@
 			};
 			sharedResources.add(uniqueName, newResource);
 		}
-		return new ResourceReference(scope == null ? Application.class : scope, uniqueName);
+		return new ResourceReference((Class)scopeRef.get(), uniqueName);
 	}
 
 	/**