diff options
author | Marko Mihovilic | 2013-06-13 16:40:39 +0000 |
---|---|---|
committer | Jesse McConnell | 2013-06-13 21:45:49 +0000 |
commit | 953ab44909c1ebcc613ed7ec98d0a82fed458f5c (patch) | |
tree | bf9baf0ed84e5dfb7b1ccd937f4011715a91732f | |
parent | a582b42d45a2ef54768f8d75e7e64fcdf0a73e05 (diff) | |
download | org.eclipse.jetty.project-953ab44909c1ebcc613ed7ec98d0a82fed458f5c.tar.gz org.eclipse.jetty.project-953ab44909c1ebcc613ed7ec98d0a82fed458f5c.tar.xz org.eclipse.jetty.project-953ab44909c1ebcc613ed7ec98d0a82fed458f5c.zip |
[Bug 410750] NoSQLSessions: implement session context data persistence across server restarts
-rw-r--r-- | jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSessionManager.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSessionManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSessionManager.java index 38f148e653..3a70ef61dc 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSessionManager.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSessionManager.java @@ -40,6 +40,7 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme private int _savePeriod=0; private int _idlePeriod=-1; private boolean _invalidateOnStop; + private boolean _preserveOnStop; private boolean _saveAllAttributes; /* ------------------------------------------------------------ */ @@ -104,7 +105,10 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme for (NoSqlSession session : sessions) { session.save(false); - removeSession(session,false); + + if (!_preserveOnStop) { + removeSession(session,false); + } } } else @@ -279,6 +283,16 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme /* ------------------------------------------------------------ */ /** + * Preserve sessions when the session manager is stopped otherwise remove them from the DB. + * @return the removeOnStop + */ + public boolean isPreserveOnStop() + { + return _preserveOnStop; + } + + /* ------------------------------------------------------------ */ + /** * Invalidate sessions when the session manager is stopped otherwise save them to the DB. * @param invalidateOnStop the invalidateOnStop to set */ @@ -289,6 +303,16 @@ public abstract class NoSqlSessionManager extends AbstractSessionManager impleme /* ------------------------------------------------------------ */ /** + * Preserve sessions when the session manager is stopped otherwise remove them from the DB. + * @param removeOnStop the removeOnStop to set + */ + public void setPreserveOnStop(boolean preserveOnStop) + { + _preserveOnStop = preserveOnStop; + } + + /* ------------------------------------------------------------ */ + /** * Save all attributes of a session or only update the dirty attributes. * @return the saveAllAttributes */ |