Modified distributed object attribute setting such that attributes are
*always* set immediately because after some deliberation, we decided that doing that led to less unexpectedly annoying behavior than having to wait for the event to propagate to see the new value. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1062 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
+22
-19
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id: gendobj,v 1.6 2002/02/09 00:10:19 mdb Exp $
|
||||
# $Id: gendobj,v 1.7 2002/02/20 23:35:42 mdb Exp $
|
||||
#
|
||||
# gendobj is used to generate DObject source file definitons basded on
|
||||
# abbreviated declarations. Because DObject fields all have standard
|
||||
@@ -184,7 +184,8 @@ sub print_dobj_setters
|
||||
|
||||
/**
|
||||
* Requests that the specified element be added to the
|
||||
* <code>$field</code> set.
|
||||
* <code>$field</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public void addTo$cfield (DSet.Element elem)
|
||||
{
|
||||
@@ -193,7 +194,8 @@ sub print_dobj_setters
|
||||
|
||||
/**
|
||||
* Requests that the element matching the supplied key be removed from
|
||||
* the <code>$field</code> set.
|
||||
* the <code>$field</code> set. The set will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFrom$cfield (Object key)
|
||||
{
|
||||
@@ -202,7 +204,8 @@ sub print_dobj_setters
|
||||
|
||||
/**
|
||||
* Requests that the specified element be updated in the
|
||||
* <code>$field</code> set.
|
||||
* <code>$field</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public void update$cfield (DSet.Element elem)
|
||||
{
|
||||
@@ -213,10 +216,15 @@ sub print_dobj_setters
|
||||
* Requests that the <code>$field</code> field be set to the
|
||||
* specified value. Generally one only adds, updates and removes
|
||||
* elements of a distributed set, but certain situations call for a
|
||||
* complete replacement of the set value.
|
||||
* complete replacement of the set value. The local value will be
|
||||
* updated immediately and an event will be propagated through the
|
||||
* system to notify all listeners that the attribute did
|
||||
* change. Proxied copies of this object (on clients) will apply the
|
||||
* value change when they received the attribute changed notification.
|
||||
*/
|
||||
public void set$cfield (DSet value)
|
||||
{
|
||||
this.$field = $field;
|
||||
requestAttributeChange($fcode, value);
|
||||
}
|
||||
EOF
|
||||
@@ -226,7 +234,8 @@ EOF
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be added to the
|
||||
* <code>$field</code> oid list.
|
||||
* <code>$field</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void addTo$cfield (int oid)
|
||||
{
|
||||
@@ -235,7 +244,8 @@ EOF
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be removed from the
|
||||
* <code>$field</code> oid list.
|
||||
* <code>$field</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFrom$cfield (int oid)
|
||||
{
|
||||
@@ -248,20 +258,13 @@ EOF
|
||||
|
||||
/**
|
||||
* Requests that the <code>$field</code> field be set to the specified
|
||||
* value.
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void set$cfield ($type $field)
|
||||
{
|
||||
requestAttributeChange($fcode, $dobjval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>$field</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void set${cfield}Immediate ($type $field)
|
||||
{
|
||||
this.$field = $field;
|
||||
requestAttributeChange($fcode, $dobjval);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BodyObject.java,v 1.1 2002/02/08 23:10:36 mdb Exp $
|
||||
// $Id: BodyObject.java,v 1.2 2002/02/20 23:35:42 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
@@ -26,20 +26,13 @@ public class BodyObject extends ClientObject
|
||||
|
||||
/**
|
||||
* Requests that the <code>username</code> field be set to the specified
|
||||
* value.
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setUsername (String username)
|
||||
{
|
||||
requestAttributeChange(USERNAME, username);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>username</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void setUsernameImmediate (String username)
|
||||
{
|
||||
this.username = username;
|
||||
requestAttributeChange(USERNAME, username);
|
||||
@@ -47,20 +40,13 @@ public class BodyObject extends ClientObject
|
||||
|
||||
/**
|
||||
* Requests that the <code>location</code> field be set to the specified
|
||||
* value.
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setLocation (int location)
|
||||
{
|
||||
requestAttributeChange(LOCATION, new Integer(location));
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>location</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void setLocationImmediate (int location)
|
||||
{
|
||||
this.location = location;
|
||||
requestAttributeChange(LOCATION, new Integer(location));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PlaceObject.java,v 1.2 2002/02/08 23:54:25 mdb Exp $
|
||||
// $Id: PlaceObject.java,v 1.3 2002/02/20 23:35:42 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
@@ -28,7 +28,8 @@ public class PlaceObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be added to the
|
||||
* <code>occupants</code> oid list.
|
||||
* <code>occupants</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void addToOccupants (int oid)
|
||||
{
|
||||
@@ -37,7 +38,8 @@ public class PlaceObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be removed from the
|
||||
* <code>occupants</code> oid list.
|
||||
* <code>occupants</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFromOccupants (int oid)
|
||||
{
|
||||
@@ -46,7 +48,8 @@ public class PlaceObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the specified element be added to the
|
||||
* <code>occupantInfo</code> set.
|
||||
* <code>occupantInfo</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public void addToOccupantInfo (DSet.Element elem)
|
||||
{
|
||||
@@ -55,7 +58,8 @@ public class PlaceObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the element matching the supplied key be removed from
|
||||
* the <code>occupantInfo</code> set.
|
||||
* the <code>occupantInfo</code> set. The set will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFromOccupantInfo (Object key)
|
||||
{
|
||||
@@ -64,7 +68,8 @@ public class PlaceObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the specified element be updated in the
|
||||
* <code>occupantInfo</code> set.
|
||||
* <code>occupantInfo</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public void updateOccupantInfo (DSet.Element elem)
|
||||
{
|
||||
@@ -75,10 +80,15 @@ public class PlaceObject extends DObject
|
||||
* Requests that the <code>occupantInfo</code> field be set to the
|
||||
* specified value. Generally one only adds, updates and removes
|
||||
* elements of a distributed set, but certain situations call for a
|
||||
* complete replacement of the set value.
|
||||
* complete replacement of the set value. The local value will be
|
||||
* updated immediately and an event will be propagated through the
|
||||
* system to notify all listeners that the attribute did
|
||||
* change. Proxied copies of this object (on clients) will apply the
|
||||
* value change when they received the attribute changed notification.
|
||||
*/
|
||||
public void setOccupantInfo (DSet value)
|
||||
{
|
||||
this.occupantInfo = occupantInfo;
|
||||
requestAttributeChange(OCCUPANT_INFO, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: CrowdClient.java,v 1.6 2002/02/03 03:09:06 mdb Exp $
|
||||
// $Id: CrowdClient.java,v 1.7 2002/02/20 23:35:42 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.server;
|
||||
|
||||
@@ -19,11 +19,8 @@ public class CrowdClient extends PresentsClient
|
||||
// cast our client object to a body object
|
||||
_bodobj = (BodyObject)_clobj;
|
||||
|
||||
// and configure our username (we use the setImmediate form so
|
||||
// that entities later in the session start processing can access
|
||||
// fields set in the body object without having to wait for them
|
||||
// to be flushed through the dobject queue)
|
||||
_bodobj.setUsernameImmediate(_username);
|
||||
// and configure our username
|
||||
_bodobj.setUsername(_username);
|
||||
|
||||
// register our body object mapping
|
||||
CrowdServer.mapBody(_username, _bodobj);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TableLobbyObject.java,v 1.1 2002/02/08 23:55:24 mdb Exp $
|
||||
// $Id: TableLobbyObject.java,v 1.2 2002/02/20 23:35:42 mdb Exp $
|
||||
|
||||
package com.threerings.micasa.lobby.table;
|
||||
|
||||
@@ -43,7 +43,8 @@ public class TableLobbyObject
|
||||
|
||||
/**
|
||||
* Requests that the specified element be added to the
|
||||
* <code>tableSet</code> set.
|
||||
* <code>tableSet</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public void addToTableSet (DSet.Element elem)
|
||||
{
|
||||
@@ -52,7 +53,8 @@ public class TableLobbyObject
|
||||
|
||||
/**
|
||||
* Requests that the element matching the supplied key be removed from
|
||||
* the <code>tableSet</code> set.
|
||||
* the <code>tableSet</code> set. The set will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFromTableSet (Object key)
|
||||
{
|
||||
@@ -61,7 +63,8 @@ public class TableLobbyObject
|
||||
|
||||
/**
|
||||
* Requests that the specified element be updated in the
|
||||
* <code>tableSet</code> set.
|
||||
* <code>tableSet</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public void updateTableSet (DSet.Element elem)
|
||||
{
|
||||
@@ -72,10 +75,15 @@ public class TableLobbyObject
|
||||
* Requests that the <code>tableSet</code> field be set to the
|
||||
* specified value. Generally one only adds, updates and removes
|
||||
* elements of a distributed set, but certain situations call for a
|
||||
* complete replacement of the set value.
|
||||
* complete replacement of the set value. The local value will be
|
||||
* updated immediately and an event will be propagated through the
|
||||
* system to notify all listeners that the attribute did
|
||||
* change. Proxied copies of this object (on clients) will apply the
|
||||
* value change when they received the attribute changed notification.
|
||||
*/
|
||||
public void setTableSet (DSet value)
|
||||
{
|
||||
this.tableSet = tableSet;
|
||||
requestAttributeChange(TABLE_SET, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameManager.java,v 1.22 2002/02/15 03:42:32 mdb Exp $
|
||||
// $Id: GameManager.java,v 1.23 2002/02/20 23:35:42 mdb Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
@@ -220,11 +220,8 @@ public class GameManager extends PlaceManager
|
||||
{
|
||||
// figure out who won...
|
||||
|
||||
// transition to the game over state (do so using setImmediate so
|
||||
// that game manager code doesn't have to keep its own "immediate"
|
||||
// game over indicator in order to prevent stray, post-end-game
|
||||
// events from messing things up)
|
||||
_gameobj.setStateImmediate(GameObject.GAME_OVER);
|
||||
// transition to the game over state
|
||||
_gameobj.setState(GameObject.GAME_OVER);
|
||||
|
||||
// wait until we hear the game state transition on the game object
|
||||
// to invoke our game over code so that we can be sure that any
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameObject.java,v 1.2 2002/02/13 03:21:28 mdb Exp $
|
||||
// $Id: GameObject.java,v 1.3 2002/02/20 23:35:42 mdb Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
@@ -52,20 +52,13 @@ public class GameObject extends PlaceObject
|
||||
|
||||
/**
|
||||
* Requests that the <code>state</code> field be set to the specified
|
||||
* value.
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setState (int state)
|
||||
{
|
||||
requestAttributeChange(STATE, new Integer(state));
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>state</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void setStateImmediate (int state)
|
||||
{
|
||||
this.state = state;
|
||||
requestAttributeChange(STATE, new Integer(state));
|
||||
@@ -73,20 +66,13 @@ public class GameObject extends PlaceObject
|
||||
|
||||
/**
|
||||
* Requests that the <code>isRated</code> field be set to the specified
|
||||
* value.
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setIsRated (boolean isRated)
|
||||
{
|
||||
requestAttributeChange(IS_RATED, new Boolean(isRated));
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>isRated</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void setIsRatedImmediate (boolean isRated)
|
||||
{
|
||||
this.isRated = isRated;
|
||||
requestAttributeChange(IS_RATED, new Boolean(isRated));
|
||||
@@ -94,20 +80,13 @@ public class GameObject extends PlaceObject
|
||||
|
||||
/**
|
||||
* Requests that the <code>players</code> field be set to the specified
|
||||
* value.
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setPlayers (String[] players)
|
||||
{
|
||||
requestAttributeChange(PLAYERS, players);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>players</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void setPlayersImmediate (String[] players)
|
||||
{
|
||||
this.players = players;
|
||||
requestAttributeChange(PLAYERS, players);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TestObject.java,v 1.1 2002/02/08 23:17:38 mdb Exp $
|
||||
// $Id: TestObject.java,v 1.2 2002/02/20 23:35:42 mdb Exp $
|
||||
|
||||
package com.threerings.presents.server;
|
||||
|
||||
@@ -25,20 +25,13 @@ public class TestObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the <code>foo</code> field be set to the specified
|
||||
* value.
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setFoo (int foo)
|
||||
{
|
||||
requestAttributeChange(FOO, new Integer(foo));
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>foo</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void setFooImmediate (int foo)
|
||||
{
|
||||
this.foo = foo;
|
||||
requestAttributeChange(FOO, new Integer(foo));
|
||||
@@ -46,20 +39,13 @@ public class TestObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the <code>bar</code> field be set to the specified
|
||||
* value.
|
||||
* value. The local value will be updated immediately and an event
|
||||
* will be propagated through the system to notify all listeners that
|
||||
* the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setBar (String bar)
|
||||
{
|
||||
requestAttributeChange(BAR, bar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>bar</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void setBarImmediate (String bar)
|
||||
{
|
||||
this.bar = bar;
|
||||
requestAttributeChange(BAR, bar);
|
||||
@@ -67,7 +53,8 @@ public class TestObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be added to the
|
||||
* <code>list</code> oid list.
|
||||
* <code>list</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void addToList (int oid)
|
||||
{
|
||||
@@ -76,7 +63,8 @@ public class TestObject extends DObject
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be removed from the
|
||||
* <code>list</code> oid list.
|
||||
* <code>list</code> oid list. The list will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFromList (int oid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user