423255 MBeans of SessionIdManager can leak memory on redeploy

This commit is contained in:
Jan Bartel 2013-12-16 14:01:56 +11:00
parent cf3acd376f
commit dd0f50fc72
1 changed files with 16 additions and 2 deletions

View File

@ -227,11 +227,25 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
_sessionIdManager=server.getSessionIdManager(); _sessionIdManager=server.getSessionIdManager();
if (_sessionIdManager==null) if (_sessionIdManager==null)
{ {
//create a default SessionIdManager and set it as the shared
//SessionIdManager for the Server, being careful NOT to use
//the webapp context's classloader, otherwise if the context
//is stopped, the classloader is leaked.
ClassLoader serverLoader = server.getClass().getClassLoader();
try
{
Thread.currentThread().setContextClassLoader(serverLoader);
_sessionIdManager=new HashSessionIdManager(); _sessionIdManager=new HashSessionIdManager();
server.setSessionIdManager(_sessionIdManager); server.setSessionIdManager(_sessionIdManager);
} }
finally
{
Thread.currentThread().setContextClassLoader(_loader);
} }
} }
}
}
if (!_sessionIdManager.isStarted()) if (!_sessionIdManager.isStarted())
_sessionIdManager.start(); _sessionIdManager.start();