Merge branch 'jetty-7' into jetty-8

This commit is contained in:
Jesse McConnell 2013-08-20 13:02:40 -05:00
commit b4fab3fbc5
1 changed files with 44 additions and 3 deletions

View File

@ -63,16 +63,57 @@ public class NoSqlSession extends AbstractSession
{ {
synchronized (this) synchronized (this)
{ {
if (_dirty==null)
_dirty=new HashSet<String>();
_dirty.add(name);
Object old = super.doPutOrRemove(name,value); Object old = super.doPutOrRemove(name,value);
if (_manager.getSavePeriod()==-2) if (_manager.getSavePeriod()==-2)
{
save(true); save(true);
}
return old; 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 @Override
protected void checkValid() throws IllegalStateException protected void checkValid() throws IllegalStateException