Widening.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@320 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -35,16 +35,15 @@ import com.threerings.whirled.server.WhirledServer;
|
||||
import com.threerings.whirled.util.UpdateList;
|
||||
|
||||
/**
|
||||
* The scene manager extends the place manager and takes care of basic
|
||||
* scene services. Presently that is little more than registering the
|
||||
* scene manager with the scene registry so that the manager can be looked
|
||||
* up by scene id in addition to place object id.
|
||||
* The scene manager extends the place manager and takes care of basic scene services. Presently
|
||||
* that is little more than registering the scene manager with the scene registry so that the
|
||||
* manager can be looked up by scene id in addition to place object id.
|
||||
*/
|
||||
public class SceneManager extends PlaceManager
|
||||
{
|
||||
/**
|
||||
* Returns the scene object (not the scene distributed object) being
|
||||
* managed by this scene manager.
|
||||
* Returns the scene object (not the scene distributed object) being managed by this scene
|
||||
* manager.
|
||||
*/
|
||||
public Scene getScene ()
|
||||
{
|
||||
@@ -60,25 +59,21 @@ public class SceneManager extends PlaceManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the scene registry once the scene manager has been
|
||||
* created (and initialized), but before it is started up.
|
||||
* Called by the scene registry once the scene manager has been created (and initialized), but
|
||||
* before it is started up.
|
||||
*/
|
||||
protected void setSceneData (Scene scene, UpdateList updates,
|
||||
SceneRegistry screg)
|
||||
protected void setSceneData (Scene scene, UpdateList updates, SceneRegistry screg)
|
||||
{
|
||||
_scene = scene;
|
||||
_screg = screg;
|
||||
_updates = updates;
|
||||
|
||||
// make sure the list and our version of the scene are in
|
||||
// accordance
|
||||
// make sure the list and our version of the scene are in accordance
|
||||
if (!_updates.validate(scene.getVersion())) {
|
||||
Log.warning("Provided with invalid updates; flushing " +
|
||||
"[where=" + where() +
|
||||
", sceneId=" + scene.getId() + "].");
|
||||
// clear out the update list as it will not allow us to bring
|
||||
// clients up to date with our current scene version; instead
|
||||
// they'll have to download the whole thing
|
||||
Log.warning("Provided with invalid updates; flushing [where=" + where() +
|
||||
", sceneId=" + scene.getId() + ", version=" + scene.getVersion() + "].");
|
||||
// clear out the update list as it will not allow us to bring clients up to date with
|
||||
// our current scene version; instead they'll have to download the whole thing
|
||||
_updates = new UpdateList();
|
||||
}
|
||||
|
||||
@@ -87,26 +82,24 @@ public class SceneManager extends PlaceManager
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that can be overridden by derived classes to perform
|
||||
* initialization processing after we receive our scene information
|
||||
* but before we're started up (and hence registered as an active
|
||||
* place).
|
||||
* A method that can be overridden by derived classes to perform initialization processing
|
||||
* after we receive our scene information but before we're started up (and hence registered as
|
||||
* an active place).
|
||||
*/
|
||||
protected void gotSceneData ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* We're fully ready to go, so now we register ourselves with the
|
||||
* scene registry which will make us available to the clients and
|
||||
* system at large.
|
||||
* We're fully ready to go, so now we register ourselves with the scene registry which will
|
||||
* make us available to the clients and system at large.
|
||||
*/
|
||||
protected void didStartup ()
|
||||
{
|
||||
super.didStartup();
|
||||
|
||||
// Wait until us and all of our subclasses have completely finished
|
||||
// running didStartup prior to registering the scene as being ready.
|
||||
// Wait until us and all of our subclasses have completely finished running didStartup
|
||||
// prior to registering the scene as being ready.
|
||||
PresentsServer.omgr.postRunnable(new Runnable() {
|
||||
public void run () {
|
||||
_screg.sceneManagerDidStart(SceneManager.this);
|
||||
@@ -126,18 +119,15 @@ public class SceneManager extends PlaceManager
|
||||
}
|
||||
|
||||
/**
|
||||
* When a modification is made to a scene, the scene manager should
|
||||
* create a SceneUpdate instance and pass it to this method which will
|
||||
* update the in-memory scene, and apply and record the update in the
|
||||
* scene repository.
|
||||
* When a modification is made to a scene, the scene manager should create a SceneUpdate
|
||||
* instance and pass it to this method which will update the in-memory scene, and apply and
|
||||
* record the update in the scene repository.
|
||||
*
|
||||
* <p> This update will be stored persistently and provided (along
|
||||
* with any other accumulated updates) to clients that later request
|
||||
* to enter the scene with an old version of the scene data. Updates
|
||||
* are not stored forever, but a sizable number of recent updates are
|
||||
* stored so that moderately current clients can apply incremental
|
||||
* patches to their scenes rather than redownloading entire scenes
|
||||
* when they change.
|
||||
* <p> This update will be stored persistently and provided (along with any other accumulated
|
||||
* updates) to clients that later request to enter the scene with an old version of the scene
|
||||
* data. Updates are not stored forever, but a sizable number of recent updates are stored so
|
||||
* that moderately current clients can apply incremental patches to their scenes rather than
|
||||
* redownloading entire scenes when they change.
|
||||
*/
|
||||
protected void recordUpdate (final SceneUpdate update)
|
||||
{
|
||||
@@ -168,8 +158,7 @@ public class SceneManager extends PlaceManager
|
||||
// documentation inherited
|
||||
public String where ()
|
||||
{
|
||||
return _scene.getName() + " (" + super.where() + ":" +
|
||||
_scene.getId() + ")";
|
||||
return _scene.getName() + " (" + super.where() + ":" + _scene.getId() + ")";
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -179,16 +168,16 @@ public class SceneManager extends PlaceManager
|
||||
buf.append(", scene=").append(_scene);
|
||||
}
|
||||
|
||||
/** A reference to our scene implementation which provides a
|
||||
* meaningful interpretation of the data in the scene model. */
|
||||
/** A reference to our scene implementation which provides a meaningful interpretation of the
|
||||
* data in the scene model. */
|
||||
protected Scene _scene;
|
||||
|
||||
/** A list of the updates tracked for this scene. These will be used
|
||||
* to attempt to bring clients up to date efficiently if they request
|
||||
* to enter our scene with old scene model data. */
|
||||
/** A list of the updates tracked for this scene. These will be used to attempt to bring
|
||||
* clients up to date efficiently if they request to enter our scene with old scene model
|
||||
* data. */
|
||||
protected UpdateList _updates;
|
||||
|
||||
/** A reference to the scene registry so that we can call back to it
|
||||
* when we're fully initialized. */
|
||||
/** A reference to the scene registry so that we can call back to it when we're fully
|
||||
* initialized. */
|
||||
protected SceneRegistry _screg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user