Apply additions and removals to OidList fields on DObjects immediately on the server to make it
match DSets and setting attributes. With the old behvaior, if a client subscribed to a DObject and modified an OidList on it in a single pass, it could miss the modification. The DObject is serialized immediately when the server gets the subscription request, but events aren't sent for that subscription till it's processed the next time the omgr queue comes round. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6420 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -43,9 +43,15 @@ public class ObjectRemovedEvent extends NamedEvent
|
||||
* @param oid the oid to remove from the oid list attribute.
|
||||
*/
|
||||
public ObjectRemovedEvent (int targetOid, String name, int oid)
|
||||
{
|
||||
this (targetOid, name, oid, false);
|
||||
}
|
||||
|
||||
protected ObjectRemovedEvent (int targetOid, String name, int oid, boolean alreadyApplied)
|
||||
{
|
||||
super(targetOid, name);
|
||||
_oid = oid;
|
||||
_alreadyApplied = alreadyApplied;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,12 +70,20 @@ public class ObjectRemovedEvent extends NamedEvent
|
||||
return _oid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean alreadyApplied ()
|
||||
{
|
||||
return _alreadyApplied;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyToObject (DObject target)
|
||||
throws ObjectAccessException
|
||||
{
|
||||
OidList list = (OidList)target.getAttribute(_name);
|
||||
list.remove(_oid);
|
||||
if (!_alreadyApplied) {
|
||||
OidList list = (OidList)target.getAttribute(_name);
|
||||
list.remove(_oid);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -90,4 +104,5 @@ public class ObjectRemovedEvent extends NamedEvent
|
||||
}
|
||||
|
||||
protected int _oid;
|
||||
protected transient boolean _alreadyApplied;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user