337784 Improve HashSessionManager for session migrations

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2813 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-02-22 03:49:59 +00:00
parent 3f840d3403
commit 5dcd74cda5
2 changed files with 26 additions and 9 deletions

View File

@ -12,6 +12,7 @@ jetty-7.3.1-SNAPSHOT
+ 337271 Flush SSL endpoint when dispatch thread held forever
+ 337678 Readded optional async connection mode for HttpClient
+ 337685 Work in progress on draft 5 websockets
+ 337784 Improve HashSessionManager for session migrations
+ JETTY-1331 Allow alternate XML configuration processors (eg spring)
jetty-7.3.0.v20110203 3 February 2011

View File

@ -376,7 +376,9 @@ public class HashSessionManager extends AbstractSessionManager
return null;
HashedSession session = sessions.get(idInCluster);
if (session == null && _lazyLoad)
session=restoreSession(idInCluster);
if (session == null)
return null;
@ -461,24 +463,38 @@ public class HashSessionManager extends AbstractSessionManager
return;
}
File[] files = _storeDir.listFiles();
String[] files = _storeDir.list();
for (int i=0;files!=null&&i<files.length;i++)
{
try
restoreSession(files[i]);
}
}
/* ------------------------------------------------------------ */
protected synchronized HashedSession restoreSession(String idInCuster)
{
try
{
File file = new File(_storeDir,idInCuster);
if (file.exists())
{
FileInputStream in = new FileInputStream(files[i]);
FileInputStream in = new FileInputStream(file);
HashedSession session = restoreSession(in, null);
in.close();
addSession(session, false);
session.didActivate();
files[i].delete();
}
catch (Exception e)
{
Log.warn("Problem restoring session "+files[i].getName(), e);
file.delete();
return session;
}
}
catch (Exception e)
{
Log.warn("Problem restoring session "+idInCuster, e);
}
return null;
}
/* ------------------------------------------------------------ */
public void saveSessions() throws Exception