diff options
author | Jesse McConnell | 2013-08-20 18:03:26 +0000 |
---|---|---|
committer | Jesse McConnell | 2013-08-20 18:03:26 +0000 |
commit | 724b96955d71be5ef929e9dcca8f5fc4d65b0a4f (patch) | |
tree | 406b470ef5a580aa2e82c0a06c48a5e3f866d29c /jetty-nosql/src | |
parent | a69deacc4ccde7f1eca506529e2786a06587858e (diff) | |
parent | b4fab3fbc52c9afcf8bf69da6cdf56fa07bfe4ef (diff) | |
download | org.eclipse.jetty.project-724b96955d71be5ef929e9dcca8f5fc4d65b0a4f.tar.gz org.eclipse.jetty.project-724b96955d71be5ef929e9dcca8f5fc4d65b0a4f.tar.xz org.eclipse.jetty.project-724b96955d71be5ef929e9dcca8f5fc4d65b0a4f.zip |
Merge branch 'jetty-8'
Diffstat (limited to 'jetty-nosql/src')
-rw-r--r-- | jetty-nosql/src/main/java/org/eclipse/jetty/nosql/NoSqlSession.java | 47 |
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 f04874d192..53fb9805aa 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 |