summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMarko Mihovilic2013-06-13 12:40:39 (EDT)
committer Jesse McConnell2013-06-13 17:45:49 (EDT)
commit953ab44909c1ebcc613ed7ec98d0a82fed458f5c (patch)
treebf9baf0ed84e5dfb7b1ccd937f4011715a91732f
parenta582b42d45a2ef54768f8d75e7e64fcdf0a73e05 (diff)
downloadorg.eclipse.jetty.project-953ab44909c1ebcc613ed7ec98d0a82fed458f5c.zip
org.eclipse.jetty.project-953ab44909c1ebcc613ed7ec98d0a82fed458f5c.tar.gz
org.eclipse.jetty.project-953ab44909c1ebcc613ed7ec98d0a82fed458f5c.tar.bz2
[Bug 410750] NoSQLSessions: implement session context data persistence across server restarts
-rw-r--r--jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSessionManager.java26
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 38f148e..3a70ef6 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
*/