Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse McConnell2013-08-20 14:01:52 -0400
committerJesse McConnell2013-08-20 14:01:52 -0400
commit3d6711b4ab6a43ba76a0c92da3a7a25a05094ef9 (patch)
tree23e64e3f9ff1109318a014c4bf9f14f52123baf8
parent54a899d55f30ed52cfdced57ff5c7921274a6162 (diff)
downloadorg.eclipse.jetty.project-3d6711b4ab6a43ba76a0c92da3a7a25a05094ef9.tar.gz
org.eclipse.jetty.project-3d6711b4ab6a43ba76a0c92da3a7a25a05094ef9.tar.xz
org.eclipse.jetty.project-3d6711b4ab6a43ba76a0c92da3a7a25a05094ef9.zip
[Bug 413484] setAttribute in nosql session management better handles _dirty status
-rw-r--r--jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java47
1 files changed, 44 insertions, 3 deletions
diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java
index c0784d91dc..58861e021e 100644
--- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java
+++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java
@@ -63,16 +63,57 @@ public class NoSqlSession extends AbstractSession
{
synchronized (this)
{
- if (_dirty==null)
- _dirty=new HashSet<String>();
- _dirty.add(name);
Object old = super.doPutOrRemove(name,value);
+
if (_manager.getSavePeriod()==-2)
+ {
save(true);
+ }
return old;
}
}
+
+
+
+ @Override
+ public void setAttribute(String name, Object value)
+ {
+ if ( updateAttribute(name,value) )
+ {
+ if (_dirty==null)
+ {
+ _dirty=new HashSet<String>();
+ }
+
+ _dirty.add(name);
+ }
+ }
+
+ /*
+ * a boolean version of the setAttribute method that lets us manage the _dirty set
+ */
+ protected boolean updateAttribute (String name, Object value)
+ {
+ Object old=null;
+ synchronized (this)
+ {
+ checkValid();
+ old=doPutOrRemove(name,value);
+ }
+
+ if (value==null || !value.equals(old))
+ {
+ if (old!=null)
+ unbindValue(name,old);
+ if (value!=null)
+ bindValue(name,value);
+ _manager.doSessionAttributeListeners(this,name,old,value);
+ return true;
+ }
+ return false;
+ }
+
/* ------------------------------------------------------------ */
@Override
protected void checkValid() throws IllegalStateException

Back to the top