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 06:51:37 UTC

svn commit: r548210 - /incubator/wicket/trunk/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java

Author: almaw
Date: Sun Jun 17 21:51:35 2007
New Revision: 548210

URL: http://svn.apache.org/viewvc?view=rev&rev=548210
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.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java

Modified: incubator/wicket/trunk/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java?view=diff&rev=548210&r1=548209&r2=548210
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java Sun Jun 17 21:51:35 2007
@@ -16,6 +16,8 @@
  */
 package org.apache.wicket.authentication;
 
+import java.lang.ref.WeakReference;
+
 import org.apache.wicket.Component;
 import org.apache.wicket.Page;
 import org.apache.wicket.Request;
@@ -43,7 +45,7 @@
 			IUnauthorizedComponentInstantiationListener
 {
 	/** Subclass of authenticated web session to instantiate */
-	private final Class<? extends AuthenticatedWebSession> webSessionClass;
+	private final WeakReference<Class<? extends AuthenticatedWebSession>> webSessionClassRef;
 
 	/**
 	 * Constructor
@@ -51,7 +53,7 @@
 	public AuthenticatedWebApplication()
 	{
 		// Get web session class to instantiate
-		this.webSessionClass = getWebSessionClass();
+		this.webSessionClassRef = new WeakReference<Class<? extends AuthenticatedWebSession>>(getWebSessionClass());
 	}
 
 	@Override
@@ -108,13 +110,13 @@
 	{
 		try
 		{
-			return webSessionClass.getDeclaredConstructor(AuthenticatedWebApplication.class,
+			return webSessionClassRef.get().getDeclaredConstructor(AuthenticatedWebApplication.class,
 					Request.class).newInstance(AuthenticatedWebApplication.this, request);
 		}
 		catch (Exception e)
 		{
 			throw new WicketRuntimeException(
-					"Unable to instantiate web session " + webSessionClass, e);
+					"Unable to instantiate web session " + webSessionClassRef.get(), e);
 		}
 	}