diff options
author | Greg Wilkins | 2011-02-22 03:49:59 +0000 |
---|---|---|
committer | Greg Wilkins | 2011-02-22 03:49:59 +0000 |
commit | 5dcd74cda5acbf703a459aaad1d945a7a4b70616 (patch) | |
tree | a629a2326caca06c7048bce39e3c27e66a2f8222 | |
parent | 3f840d3403fb852b9133aa6900186071a788f68e (diff) | |
download | org.eclipse.jetty.project-5dcd74cda5acbf703a459aaad1d945a7a4b70616.tar.gz org.eclipse.jetty.project-5dcd74cda5acbf703a459aaad1d945a7a4b70616.tar.xz org.eclipse.jetty.project-5dcd74cda5acbf703a459aaad1d945a7a4b70616.zip |
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
-rw-r--r-- | VERSION.txt | 1 | ||||
-rw-r--r-- | jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java | 34 |
2 files changed, 26 insertions, 9 deletions
diff --git a/VERSION.txt b/VERSION.txt index 9d138227d0..2763f6046a 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -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 diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java index 3d28df976e..67f036b7a9 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java @@ -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 |