Switch to new logging API.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@608 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2008-05-27 20:00:28 +00:00
parent 3b7ef57a20
commit a133c7c693
91 changed files with 486 additions and 722 deletions
+4 -35
View File
@@ -21,43 +21,12 @@
package com.threerings.whirled;
import com.samskivert.util.Logger;
/**
* A placeholder class that contains a reference to the log object used by
* the Whirled services.
* Contains a reference to the log object used by the Whirled services.
*/
public class Log
{
public static com.samskivert.util.Log log =
new com.samskivert.util.Log("whirled");
/** Convenience function. */
public static boolean debug ()
{
return (com.samskivert.util.Log.getLevel() ==
com.samskivert.util.Log.DEBUG);
}
/** Convenience function. */
public static void debug (String message)
{
log.debug(message);
}
/** Convenience function. */
public static void info (String message)
{
log.info(message);
}
/** Convenience function. */
public static void warning (String message)
{
log.warning(message);
}
/** Convenience function. */
public static void logStackTrace (Throwable t)
{
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
}
public static Logger log = Logger.getLogger("com.threerings.whirled");
}
@@ -34,7 +34,6 @@ import com.threerings.crowd.client.LocationDirector;
import com.threerings.crowd.client.LocationObserver;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.whirled.Log;
import com.threerings.whirled.client.persist.SceneRepository;
import com.threerings.whirled.data.Scene;
import com.threerings.whirled.data.SceneCodes;
@@ -44,6 +43,8 @@ import com.threerings.whirled.util.SceneFactory;
import com.threerings.whirled.util.WhirledContext;
import com.threerings.whirled.data.SceneUpdate;
import static com.threerings.whirled.Log.log;
/**
* The scene director is the client's interface to all things scene related. It interfaces with the
* scene repository to ensure that scene objects are available when the client enters a particular
@@ -138,13 +139,13 @@ public class SceneDirector extends BasicDirector
{
// make sure the sceneId is valid
if (sceneId < 0) {
Log.warning("Refusing moveTo(): invalid sceneId " + sceneId + ".");
log.warning("Refusing moveTo(): invalid sceneId " + sceneId + ".");
return false;
}
// sanity-check the destination scene id
if (sceneId == _sceneId) {
Log.warning("Refusing request to move to the same scene [sceneId=" + sceneId + "].");
log.warning("Refusing request to move to the same scene [sceneId=" + sceneId + "].");
return false;
}
@@ -177,11 +178,11 @@ public class SceneDirector extends BasicDirector
// complain if we're over-writing a pending request
if (movePending()) {
if (refuse) {
Log.warning("Refusing moveTo; We have a request outstanding " +
log.warning("Refusing moveTo; We have a request outstanding " +
"[psid=" + _pendingSceneId + ", nsid=" + sceneId + "].");
return false;
} else {
Log.warning("Overriding stale moveTo request [psid=" + _pendingSceneId +
log.warning("Overriding stale moveTo request [psid=" + _pendingSceneId +
", nsid=" + sceneId + "].");
}
}
@@ -232,7 +233,7 @@ public class SceneDirector extends BasicDirector
// complain if we didn't find a scene
if (_model == null) {
Log.warning("Aiya! Unable to load scene [sid=" + _sceneId + ", plid=" + placeId + "].");
log.warning("Aiya! Unable to load scene [sid=" + _sceneId + ", plid=" + placeId + "].");
return;
}
@@ -243,7 +244,7 @@ public class SceneDirector extends BasicDirector
// from interface SceneService.SceneMoveListener
public void moveSucceededWithUpdates (int placeId, PlaceConfig config, SceneUpdate[] updates)
{
Log.info("Got updates [placeId=" + placeId + ", config=" + config +
log.info("Got updates [placeId=" + placeId + ", config=" + config +
", updates=" + StringUtil.toString(updates) + "].");
// apply the updates to our cached scene
@@ -253,7 +254,7 @@ public class SceneDirector extends BasicDirector
try {
updates[ii].validate(model);
} catch (IllegalStateException ise) {
Log.warning("Scene update failed validation [model=" + model +
log.warning("Scene update failed validation [model=" + model +
", update=" + updates[ii] + ", error=" + ise.getMessage() + "].");
failure = true;
break;
@@ -262,9 +263,8 @@ public class SceneDirector extends BasicDirector
try {
updates[ii].apply(model);
} catch (Exception e) {
Log.warning("Failure applying scene update [model=" + model +
", update=" + updates[ii] + "].");
Log.logStackTrace(e);
log.warning("Failure applying scene update [model=" + model +
", update=" + updates[ii] + "].", e);
failure = true;
break;
}
@@ -275,9 +275,8 @@ public class SceneDirector extends BasicDirector
try {
_screp.deleteSceneModel(_pendingSceneId);
} catch (IOException ioe) {
Log.warning("Failure removing booched scene model " +
"[sceneId=" + _pendingSceneId + "].");
Log.logStackTrace(ioe);
log.warning("Failure removing booched scene model " +
"[sceneId=" + _pendingSceneId + "].", ioe);
}
// act as if the scene move failed; we'll be in a funny state because the server thinks
@@ -296,7 +295,7 @@ public class SceneDirector extends BasicDirector
// from interface SceneService.SceneMoveListener
public void moveSucceededWithScene (int placeId, PlaceConfig config, SceneModel model)
{
Log.info("Got updated scene model [placeId=" + placeId + ", config=" + config +
log.info("Got updated scene model [placeId=" + placeId + ", config=" + config +
", scene=" + model.sceneId + "/" + model.name + "/" + model.version + "].");
// update the model in the repository
@@ -358,7 +357,7 @@ public class SceneDirector extends BasicDirector
public void setMoveHandler (MoveHandler handler)
{
if (_moveHandler != null) {
Log.warning("Requested to set move handler, but we've already got one. The " +
log.warning("Requested to set move handler, but we've already got one. The " +
"conflicting entities will likely need to perform more sophisticated " +
"coordination to deal with failures. [old=" + _moveHandler +
", new=" + handler + "].");
@@ -375,12 +374,12 @@ public class SceneDirector extends BasicDirector
// just finish up what we're doing and assume that the repeated move request was the
// spurious one as it would be in the case of lag causing rapid-fire repeat requests
if (movePending()) {
Log.info("Dropping forced move because we have a move pending " +
log.info("Dropping forced move because we have a move pending " +
"[pendId=" + _pendingSceneId + ", reqId=" + sceneId + "].");
return;
}
Log.info("Moving at request of server [sceneId=" + sceneId + "].");
log.info("Moving at request of server [sceneId=" + sceneId + "].");
// clear out our old scene and place data
didLeaveScene();
// move to the new scene
@@ -424,7 +423,7 @@ public class SceneDirector extends BasicDirector
}
// issue a moveTo request
Log.info("Issuing moveTo(" + _pendingSceneId + ", " + sceneVers + ").");
log.info("Issuing moveTo(" + _pendingSceneId + ", " + sceneVers + ").");
_sservice.moveTo(_ctx.getClient(), _pendingSceneId, sceneVers, this);
}
@@ -463,7 +462,7 @@ public class SceneDirector extends BasicDirector
} catch (IOException ioe) {
// complain first, then return null
Log.warning("Error loading scene [scid=" + sceneId + ", error=" + ioe + "].");
log.warning("Error loading scene [scid=" + sceneId + ", error=" + ioe + "].");
}
}
@@ -479,9 +478,8 @@ public class SceneDirector extends BasicDirector
try {
_screp.storeSceneModel(model);
} catch (IOException ioe) {
Log.warning("Failed to update repository with updated scene [sceneId=" + model.sceneId +
", nvers=" + model.version + "].");
Log.logStackTrace(ioe);
log.warning("Failed to update repository with updated scene [sceneId=" + model.sceneId +
", nvers=" + model.version + "].", ioe);
}
}
@@ -23,7 +23,7 @@ package com.threerings.whirled.data;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.whirled.Log;
import static com.threerings.whirled.Log.log;
/**
* An implementation of the {@link Scene} interface.
@@ -99,9 +99,8 @@ public class SceneImpl implements Scene
update.validate(_model);
update.apply(_model);
} catch (Exception e) {
Log.warning("Error applying update [scene=" + this +
", update=" + update + "].");
Log.logStackTrace(e);
log.warning("Error applying update [scene=" + this +
", update=" + update + "].", e);
}
}
@@ -30,7 +30,7 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
import com.threerings.util.ActionScript;
import com.threerings.whirled.Log;
import static com.threerings.whirled.Log.log;
/**
* Used to encapsulate updates to scenes in such a manner that updates can be stored persistently
@@ -109,7 +109,7 @@ public class SceneUpdate
// sanity check for the amazing two billion updates
if (model.version == _targetVersion) {
Log.warning("Egads! This scene has been updated two billion times [model=" + model +
log.warning("Egads! This scene has been updated two billion times [model=" + model +
", update=" + this + "].");
}
}
@@ -30,7 +30,7 @@ import com.threerings.crowd.data.BodyObject;
import com.threerings.whirled.client.SceneService;
import com.threerings.whirled.data.SceneCodes;
import com.threerings.whirled.Log;
import static com.threerings.whirled.Log.log;
/**
* Handles the basics of moving a client into a new scene, which may involve resolution. Takes care
@@ -52,7 +52,7 @@ public abstract class AbstractSceneMoveHandler
// make sure our caller is still around; under heavy load, clients might end their session
// while the scene is resolving
if (!_body.isActive()) {
Log.info("Abandoning scene move, client gone [who=" + _body.who() +
log.info("Abandoning scene move, client gone [who=" + _body.who() +
", dest=" + scmgr.where() + "].");
InvocationMarshaller.setNoResponse(_listener);
return;
@@ -65,7 +65,7 @@ public abstract class AbstractSceneMoveHandler
_listener.requestFailed(sfe.getMessage());
} catch (RuntimeException re) {
Log.logStackTrace(re);
log.warning(re);
_listener.requestFailed(SceneCodes.INTERNAL_ERROR);
}
}
@@ -73,7 +73,7 @@ public abstract class AbstractSceneMoveHandler
// from interface SceneRegistry.ResolutionListener
public void sceneFailedToResolve (int sceneId, Exception reason)
{
Log.warning("Unable to resolve scene [sceneid=" + sceneId + ", reason=" + reason + "].");
log.warning("Unable to resolve scene [sceneid=" + sceneId + ", reason=" + reason + "].");
_listener.requestFailed(SceneCodes.NO_SUCH_PLACE);
}
@@ -28,7 +28,6 @@ import com.threerings.crowd.data.Place;
import com.threerings.crowd.server.CrowdServer;
import com.threerings.crowd.server.PlaceManager;
import com.threerings.whirled.Log;
import com.threerings.whirled.data.Scene;
import com.threerings.whirled.data.SceneCodes;
import com.threerings.whirled.data.ScenePlace;
@@ -36,6 +35,8 @@ import com.threerings.whirled.data.SceneUpdate;
import com.threerings.whirled.server.WhirledServer;
import com.threerings.whirled.util.UpdateList;
import static com.threerings.whirled.Log.log;
/**
* 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
@@ -87,7 +88,7 @@ public class SceneManager extends PlaceManager
// 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() +
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
@@ -37,7 +37,6 @@ import com.threerings.crowd.server.CrowdServer;
import com.threerings.crowd.server.PlaceManager;
import com.threerings.crowd.server.PlaceRegistry;
import com.threerings.whirled.Log;
import com.threerings.whirled.client.SceneService;
import com.threerings.whirled.data.Scene;
import com.threerings.whirled.data.SceneCodes;
@@ -48,6 +47,8 @@ import com.threerings.whirled.util.NoSuchSceneException;
import com.threerings.whirled.util.SceneFactory;
import com.threerings.whirled.util.UpdateList;
import static com.threerings.whirled.Log.log;
/**
* The scene registry is responsible for the management of all scenes. It handles interaction with
* the scene repository and ensures that scenes are loaded into memory when needed and flushed from
@@ -269,8 +270,7 @@ public class SceneRegistry
{
// if this is not simply a missing scene, log a warning
if (!(cause instanceof NoSuchSceneException)) {
Log.info("Failed to resolve scene [sceneId=" + sceneId + ", cause=" + cause + "].");
Log.logStackTrace(cause);
log.info("Failed to resolve scene [sceneId=" + sceneId + "].", cause);
}
// alas things didn't work out, notify our penders
@@ -280,8 +280,7 @@ public class SceneRegistry
try {
rl.sceneFailedToResolve(sceneId, cause);
} catch (Exception e) {
Log.warning("Resolution listener choked.");
Log.logStackTrace(e);
log.warning("Resolution listener choked.", e);
}
}
}
@@ -297,9 +296,7 @@ public class SceneRegistry
int sceneId = scmgr.getScene().getId();
_scenemgrs.put(sceneId, scmgr);
if (Log.debug()) {
Log.debug("Registering scene manager [scid=" + sceneId + ", scmgr=" + scmgr + "].");
}
log.debug("Registering scene manager", "scid", sceneId, "scmgr", scmgr);
// now notify any penders
ArrayList<ResolutionListener> penders = _penders.remove(sceneId);
@@ -308,8 +305,7 @@ public class SceneRegistry
try {
rl.sceneWasResolved(scmgr);
} catch (Exception e) {
Log.warning("Resolution listener choked.");
Log.logStackTrace(e);
log.warning("Resolution listener choked.", e);
}
}
}
@@ -321,13 +317,11 @@ public class SceneRegistry
protected void unmapSceneManager (SceneManager scmgr)
{
if (_scenemgrs.remove(scmgr.getScene().getId()) == null) {
Log.warning("Requested to unmap unmapped scene manager [scmgr=" + scmgr + "].");
log.warning("Requested to unmap unmapped scene manager [scmgr=" + scmgr + "].");
return;
}
if (Log.debug()) {
Log.debug("Unmapped scene manager " + scmgr + ".");
}
log.debug("Unmapped scene manager", "scmgr", scmgr);
}
/** The entity from which we load scene models. */
@@ -30,10 +30,11 @@ import com.threerings.presents.server.PresentsClient;
import com.threerings.crowd.server.CrowdServer;
import com.threerings.whirled.Log;
import com.threerings.whirled.server.persist.SceneRepository;
import com.threerings.whirled.util.SceneFactory;
import static com.threerings.whirled.Log.log;
/**
* The Whirled server extends the {@link CrowdServer} and provides access to managers and the like
* that are needed by the Whirled serviecs.
@@ -23,12 +23,13 @@ package com.threerings.whirled.server.persist;
import com.samskivert.io.PersistenceException;
import com.threerings.whirled.Log;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.data.SceneUpdate;
import com.threerings.whirled.util.NoSuchSceneException;
import com.threerings.whirled.util.UpdateList;
import static com.threerings.whirled.Log.log;
/**
* The dummy scene repository just pretends to load and store scenes, but
* in fact it just creates new blank scenes when requested to load a scene
@@ -40,7 +41,7 @@ public class DummySceneRepository implements SceneRepository
public SceneModel loadSceneModel (int sceneId)
throws PersistenceException, NoSuchSceneException
{
Log.info("Creating dummy scene [id=" + sceneId + "].");
log.info("Creating dummy scene [id=" + sceneId + "].");
return SceneModel.blankSceneModel();
}
+4 -28
View File
@@ -21,36 +21,12 @@
package com.threerings.whirled.spot;
import com.samskivert.util.Logger;
/**
* A placeholder class that contains a reference to the log object used by
* the Whirled Spot services.
* Contains a reference to the log object used by the Whirled Spot services.
*/
public class Log
{
public static com.samskivert.util.Log log =
new com.samskivert.util.Log("whirled.spot");
/** Convenience function. */
public static void debug (String message)
{
log.debug(message);
}
/** Convenience function. */
public static void info (String message)
{
log.info(message);
}
/** Convenience function. */
public static void warning (String message)
{
log.warning(message);
}
/** Convenience function. */
public static void logStackTrace (Throwable t)
{
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
}
public static Logger log = Logger.getLogger("com.threerings.whirled.spot");
}
@@ -46,13 +46,14 @@ import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.data.ScenePlace;
import com.threerings.whirled.util.WhirledContext;
import com.threerings.whirled.spot.Log;
import com.threerings.whirled.spot.data.ClusteredBodyObject;
import com.threerings.whirled.spot.data.Location;
import com.threerings.whirled.spot.data.Portal;
import com.threerings.whirled.spot.data.SpotCodes;
import com.threerings.whirled.spot.data.SpotScene;
import static com.threerings.whirled.spot.Log.log;
/**
* Extends the standard scene director with facilities to move between locations within a scene.
*/
@@ -124,7 +125,7 @@ public class SpotSceneDirector extends BasicDirector
// look up the destination scene and location
SpotScene scene = (SpotScene)_scdir.getScene();
if (scene == null) {
Log.warning("Requested to traverse portal when we have no scene " +
log.warning("Requested to traverse portal when we have no scene " +
"[portalId=" + portalId + "].");
return false;
}
@@ -133,7 +134,7 @@ public class SpotSceneDirector extends BasicDirector
int sceneId = _scdir.getScene().getId();
int clSceneId = ScenePlace.getSceneId((BodyObject)_ctx.getClient().getClientObject());
if (sceneId != clSceneId) {
Log.warning("Client and server differ in opinion of what scene we're in " +
log.warning("Client and server differ in opinion of what scene we're in " +
"[sSceneId=" + clSceneId + ", cSceneId=" + sceneId + "].");
return false;
}
@@ -141,14 +142,14 @@ public class SpotSceneDirector extends BasicDirector
// find the portal they're talking about
Portal dest = scene.getPortal(portalId);
if (dest == null) {
Log.warning("Requested to traverse non-existent portal [portalId=" + portalId +
log.warning("Requested to traverse non-existent portal [portalId=" + portalId +
", portals=" + StringUtil.toString(scene.getPortals()) + "].");
return false;
}
// prepare to move to this scene (sets up pending data)
if (!_scdir.prepareMoveTo(dest.targetSceneId, rl)) {
Log.info("Portal traversal vetoed by scene director [portalId=" + portalId + "].");
log.info("Portal traversal vetoed by scene director [portalId=" + portalId + "].");
return false;
}
@@ -161,7 +162,7 @@ public class SpotSceneDirector extends BasicDirector
}
// issue a traversePortal request
Log.info("Issuing traversePortal(" + sceneId + ", " + dest + ", " + sceneVer + ").");
log.info("Issuing traversePortal(" + sceneId + ", " + dest + ", " + sceneVer + ").");
_sservice.traversePortal(_ctx.getClient(), sceneId, portalId, sceneVer, _scdir);
return true;
}
@@ -181,7 +182,7 @@ public class SpotSceneDirector extends BasicDirector
// refuse if there's a pending location change or if we're already at the specified
// location
if (loc.equivalent(_location)) {
Log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " +
log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " +
_pendingLoc + ".");
if (listener != null) {
// This isn't really a failure, it's just a no-op.
@@ -191,7 +192,7 @@ public class SpotSceneDirector extends BasicDirector
}
if (_pendingLoc != null) {
Log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " +
log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " +
_pendingLoc + ".");
if (listener != null) {
// Already moving, best thing to do is ignore it.
@@ -202,7 +203,7 @@ public class SpotSceneDirector extends BasicDirector
SpotScene scene = (SpotScene)_scdir.getScene();
if (scene == null) {
Log.warning("Requested to change locations, but we're not currently in any scene " +
log.warning("Requested to change locations, but we're not currently in any scene " +
"[loc=" + loc + "].");
if (listener != null) {
listener.requestFailed(new Exception("m.cant_get_there"));
@@ -211,7 +212,7 @@ public class SpotSceneDirector extends BasicDirector
}
int sceneId = _scdir.getScene().getId();
Log.info("Sending changeLocation request [scid=" + sceneId + ", loc=" + loc + "].");
log.info("Sending changeLocation request [scid=" + sceneId + ", loc=" + loc + "].");
_pendingLoc = (Location)loc.clone();
ConfirmListener clist = new ConfirmListener() {
@@ -245,7 +246,7 @@ public class SpotSceneDirector extends BasicDirector
{
SpotScene scene = (SpotScene)_scdir.getScene();
if (scene == null) {
Log.warning("Requested to join cluster, but we're not currently in any scene " +
log.warning("Requested to join cluster, but we're not currently in any scene " +
"[froid=" + froid + "].");
if (listener != null) {
listener.requestFailed(new Exception("m.cant_get_there"));
@@ -253,7 +254,7 @@ public class SpotSceneDirector extends BasicDirector
return;
}
Log.info("Joining cluster [friend=" + froid + "].");
log.info("Joining cluster [friend=" + froid + "].");
_sservice.joinCluster(_ctx.getClient(), froid, new ConfirmListener() {
public void requestProcessed () {
@@ -293,14 +294,14 @@ public class SpotSceneDirector extends BasicDirector
// make sure we're currently in a scene
SpotScene scene = (SpotScene)_scdir.getScene();
if (scene == null) {
Log.warning("Requested to speak to cluster, but we're not currently in any scene " +
log.warning("Requested to speak to cluster, but we're not currently in any scene " +
"[message=" + message + "].");
return false;
}
// make sure we're part of a cluster
if (_self.getClusterOid() <= 0) {
Log.info("Ignoring cluster speak as we're not in a cluster " +
log.info("Ignoring cluster speak as we're not in a cluster " +
"[cloid=" + _self.getClusterOid() + "].");
return false;
}
@@ -333,7 +334,7 @@ public class SpotSceneDirector extends BasicDirector
// documentation inherited from interface
public void requestFailed (int oid, ObjectAccessException cause)
{
Log.warning("Unable to subscribe to cluster chat object [oid=" + oid +
log.warning("Unable to subscribe to cluster chat object [oid=" + oid +
", cause=" + cause + "].");
}
@@ -25,7 +25,7 @@ import java.util.Iterator;
import com.samskivert.util.HashIntMap;
import com.threerings.whirled.spot.Log;
import static com.threerings.whirled.spot.Log.log;
/**
* An implementation of the {@link SpotScene} interface.
@@ -103,7 +103,7 @@ public class SpotSceneImpl
public void addPortal (Portal portal)
{
if (portal.portalId <= 0) {
Log.warning("Refusing to add zero-id portal " +
log.warning("Refusing to add zero-id portal " +
"[scene=" + this + ", portal=" + portal + "].");
return;
}
@@ -37,13 +37,14 @@ import com.threerings.util.Name;
import com.threerings.whirled.client.SceneService.SceneMoveListener;
import com.threerings.whirled.data.ScenePlace;
import com.threerings.whirled.server.SceneRegistry;
import com.threerings.whirled.spot.Log;
import com.threerings.whirled.spot.client.SpotService;
import com.threerings.whirled.spot.data.Location;
import com.threerings.whirled.spot.data.Portal;
import com.threerings.whirled.spot.data.SpotCodes;
import com.threerings.whirled.spot.data.SpotScene;
import static com.threerings.whirled.spot.Log.log;
/**
* Provides the server-side implementation of the spot services.
*/
@@ -73,7 +74,7 @@ public class SpotProvider
BodyObject body = (BodyObject)caller;
int cSceneId = ScenePlace.getSceneId(body);
if (cSceneId != sceneId) {
Log.info("Ignoring stale traverse portal request [caller=" + caller.who() +
log.info("Ignoring stale traverse portal request [caller=" + caller.who() +
", oSceneId=" + sceneId + ", portalId=" + portalId +
", cSceneId=" + cSceneId + "].");
InvocationMarshaller.setNoResponse(listener);
@@ -83,7 +84,7 @@ public class SpotProvider
// obtain the source scene
SpotSceneManager srcmgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
if (srcmgr == null) {
Log.warning("Traverse portal missing source scene " +
log.warning("Traverse portal missing source scene " +
"[user=" + body.who() + ", sceneId=" + sceneId +
", portalId=" + portalId + "].");
throw new InvocationException(INTERNAL_ERROR);
@@ -101,7 +102,7 @@ public class SpotProvider
// make sure this portal has valid info
if (dest == null || !dest.isValid()) {
Log.warning("Traverse portal with invalid portal [user=" + body.who() +
log.warning("Traverse portal with invalid portal [user=" + body.who() +
", scene=" + srcmgr.where() + ", pid=" + portalId + ", portal=" + dest +
", portals=" + StringUtil.toString(rss.getPortals()) + "].");
throw new InvocationException(NO_SUCH_PORTAL);
@@ -122,7 +123,7 @@ public class SpotProvider
BodyObject source = (BodyObject)caller;
int cSceneId = ScenePlace.getSceneId(source);
if (cSceneId != sceneId) {
Log.info("Rejecting changeLocation for invalid scene [user=" + source.who() +
log.info("Rejecting changeLocation for invalid scene [user=" + source.who() +
", insid=" + cSceneId + ", wantsid=" + sceneId + ", loc=" + loc + "].");
throw new InvocationException(INVALID_LOCATION);
}
@@ -130,7 +131,7 @@ public class SpotProvider
// look up the scene manager for the specified scene
SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
if (smgr == null) {
Log.warning("User requested to change location from non-existent scene " +
log.warning("User requested to change location from non-existent scene " +
"[user=" + source.who() + ", sceneId=" + sceneId + ", loc=" + loc +"].");
throw new InvocationException(INTERNAL_ERROR);
}
@@ -155,7 +156,7 @@ public class SpotProvider
// look up the scene manager for the specified scene
SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
if (smgr == null) {
Log.warning("User requested to join cluster from non-existent scene " +
log.warning("User requested to join cluster from non-existent scene " +
"[user=" + source.who() + ", sceneId=" + sceneId +
", foid=" + friendOid +"].");
throw new InvocationException(INTERNAL_ERROR);
@@ -223,7 +224,7 @@ public class SpotProvider
// look up the scene manager for the specified scene
SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
if (smgr == null) {
Log.warning("User requested cluster chat in non-existent scene " +
log.warning("User requested cluster chat in non-existent scene " +
"[user=" + message.speaker + ", sceneId=" + sceneId +
", message=" + message + "].");
return;
@@ -25,16 +25,19 @@ import java.util.HashMap;
import java.util.Iterator;
import com.samskivert.util.HashIntMap;
import com.threerings.util.Name;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.server.InvocationException;
import com.threerings.crowd.chat.data.UserMessage;
import com.threerings.crowd.chat.server.SpeakUtil;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.OccupantInfo;
import com.threerings.crowd.server.CrowdServer;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.server.InvocationException;
import com.threerings.util.Name;
import com.threerings.whirled.server.SceneManager;
import com.threerings.whirled.spot.Log;
import com.threerings.whirled.spot.data.Cluster;
import com.threerings.whirled.spot.data.ClusterObject;
import com.threerings.whirled.spot.data.ClusteredBodyObject;
@@ -45,6 +48,8 @@ import com.threerings.whirled.spot.data.SpotCodes;
import com.threerings.whirled.spot.data.SpotScene;
import com.threerings.whirled.spot.data.SpotSceneObject;
import static com.threerings.whirled.spot.Log.log;
/**
* Handles the movement of bodies between locations in the scene and creates the necessary
* distributed objects to allow bodies in clusters to chat with one another.
@@ -143,7 +148,7 @@ public class SpotSceneManager extends SceneManager
while (cliter.hasNext()) {
ClusterRecord clrec = cliter.next();
if (clrec.containsKey(bodyOid)) {
Log.info("Pruning departed body from cluster [boid=" + bodyOid +
log.info("Pruning departed body from cluster [boid=" + bodyOid +
", cluster=" + clrec + "].");
clrec.removeBody(bodyOid);
if (clrec.size() == 0) {
@@ -176,7 +181,7 @@ public class SpotSceneManager extends SceneManager
if (from != null && from.targetPortalId != -1) {
entry = _sscene.getPortal(from.targetPortalId);
if (entry == null) {
Log.warning("Body mapped at invalid portal [where=" + where() +
log.warning("Body mapped at invalid portal [where=" + where() +
", who=" + body.who() + ", from=" + from + "].");
entry = _sscene.getDefaultEntrance();
}
@@ -212,7 +217,7 @@ public class SpotSceneManager extends SceneManager
{
SpotScene scene = (SpotScene)getScene();
if (scene == null) {
Log.warning("No scene in moveBodyToDefaultPortal()? [who=" + body.who() +
log.warning("No scene in moveBodyToDefaultPortal()? [who=" + body.who() +
", where=" + where() + "].");
return;
}
@@ -221,7 +226,7 @@ public class SpotSceneManager extends SceneManager
Location eloc = scene.getDefaultEntrance().getLocation();
handleChangeLoc(body, eloc);
} catch (InvocationException ie) {
Log.warning("Could not move user to default portal [where=" + where() +
log.warning("Could not move user to default portal [where=" + where() +
", who=" + body.who() + ", error=" + ie + "].");
}
}
@@ -241,7 +246,7 @@ public class SpotSceneManager extends SceneManager
{
// make sure they are in our scene
if (!_ssobj.occupants.contains(source.getOid())) {
Log.warning("Refusing change loc from non-scene occupant [where=" + where() +
log.warning("Refusing change loc from non-scene occupant [where=" + where() +
", who=" + source.who() + ", loc=" + loc + "].");
throw new InvocationException(INTERNAL_ERROR);
}
@@ -277,7 +282,7 @@ public class SpotSceneManager extends SceneManager
SceneLocation sloc = new SceneLocation(loc, source.getOid());
if (!_ssobj.occupantLocs.contains(sloc)) {
// complain if they don't already have a location configured
Log.warning("Changing loc for occupant without previous loc [where=" + where() +
log.warning("Changing loc for occupant without previous loc [where=" + where() +
", who=" + source.who() + ", nloc=" + loc + "].");
Thread.dumpStack();
_ssobj.addToOccupantLocs(sloc);
@@ -310,7 +315,7 @@ public class SpotSceneManager extends SceneManager
// otherwise see if they sent us the user's oid
DObject tobj = CrowdServer.omgr.getObject(targetOid);
if (!(tobj instanceof BodyObject)) {
Log.info("Can't join cluster, missing target [creator=" + joiner.who() +
log.info("Can't join cluster, missing target [creator=" + joiner.who() +
", targetOid=" + targetOid + "].");
throw new InvocationException(NO_SUCH_CLUSTER);
}
@@ -318,7 +323,7 @@ public class SpotSceneManager extends SceneManager
// make sure we're in the same scene as said user
BodyObject friend = (BodyObject)tobj;
if (friend.getPlaceOid() != joiner.getPlaceOid()) {
Log.info("Refusing cluster join from non-proximate user [joiner=" + joiner.who() +
log.info("Refusing cluster join from non-proximate user [joiner=" + joiner.who() +
", jloc=" + joiner.location + ", target=" + friend.who() +
", tloc=" + friend.location + "].");
throw new InvocationException(NO_SUCH_CLUSTER);
@@ -405,7 +410,7 @@ public class SpotSceneManager extends SceneManager
{
ClusterRecord clrec = getCluster(sourceOid);
if (clrec == null) {
Log.warning("Non-clustered user requested cluster speak [where=" + where() +
log.warning("Non-clustered user requested cluster speak [where=" + where() +
", chatter=" + message.speaker + " (" + sourceOid + "), " +
"msg=" + message + "].");
} else {
@@ -472,7 +477,7 @@ public class SpotSceneManager extends SceneManager
throws InvocationException
{
if (!(body instanceof ClusteredBodyObject)) {
Log.warning("Refusing to add non-clustered body to cluster [cloid=" +
log.warning("Refusing to add non-clustered body to cluster [cloid=" +
_clobj.getOid() + ", size=" + size() + ", who=" + body.who() + "].");
throw new InvocationException(INTERNAL_ERROR);
}
@@ -518,7 +523,7 @@ public class SpotSceneManager extends SceneManager
{
BodyObject body = (BodyObject)remove(bodyOid);
if (body == null) {
Log.warning("Requested to remove unknown body from cluster [cloid=" +
log.warning("Requested to remove unknown body from cluster [cloid=" +
_clobj.getOid() + ", size=" + size() + ", who=" + bodyOid + "].");
return;
}
@@ -29,11 +29,12 @@ import org.xml.sax.helpers.AttributesImpl;
import com.megginson.sax.DataWriter;
import com.threerings.tools.xml.NestableWriter;
import com.threerings.whirled.spot.Log;
import com.threerings.whirled.spot.data.Location;
import com.threerings.whirled.spot.data.SpotSceneModel;
import com.threerings.whirled.spot.tools.EditablePortal;
import static com.threerings.whirled.spot.Log.log;
/**
* Generates an XML representation of a {@link SpotSceneModel}.
*/
@@ -93,7 +94,7 @@ public class SpotSceneWriter
attrs.addAttribute("", fields[ii].getName(), "", "",
String.valueOf(fields[ii].get(portalLoc)));
} catch (IllegalAccessException iae) {
Log.warning("Unable to write portal field, skipping " +
log.warning("Unable to write portal field, skipping " +
"[field=" + fields[ii].getName() + ", e=" + iae + "].");
}
}
@@ -32,10 +32,11 @@ import org.xml.sax.helpers.AttributesImpl;
import com.megginson.sax.DataWriter;
import com.threerings.tools.xml.NestableWriter;
import com.threerings.whirled.Log;
import com.threerings.whirled.data.AuxModel;
import com.threerings.whirled.data.SceneModel;
import static com.threerings.whirled.Log.log;
/**
* Generates an XML representation of an {@link SceneModel}.
*/
@@ -111,7 +112,7 @@ public class SceneWriter
if (awriter != null) {
awriter.write(amodel, writer);
} else {
Log.warning("No writer registered for auxiliary scene model " +
log.warning("No writer registered for auxiliary scene model " +
"[mclass=" + amodel.getClass() + "].");
}
}
@@ -25,9 +25,10 @@ import java.util.List;
import com.google.common.collect.Lists;
import com.threerings.whirled.Log;
import com.threerings.whirled.data.SceneUpdate;
import static com.threerings.whirled.Log.log;
/**
* A list specialized for storing {@link SceneUpdate} objects.
*/
@@ -51,7 +52,7 @@ public class UpdateList
int expVersion = last.getSceneVersion() + last.getVersionIncrement();
int gotVersion = update.getSceneVersion();
if (gotVersion > expVersion) {
Log.warning("Update continuity broken, flushing list [got=" + update +
log.warning("Update continuity broken, flushing list [got=" + update +
", expect=" + expVersion + ", ucount=" + _updates.size() + "].");
_updates.clear(); // flush out our old updates, fall through and add this one
+4 -28
View File
@@ -21,36 +21,12 @@
package com.threerings.whirled.zone;
import com.samskivert.util.Logger;
/**
* A placeholder class that contains a reference to the log object used by
* the Whirled Zone services.
* Contains a reference to the log object used by the Whirled Zone services.
*/
public class Log
{
public static com.samskivert.util.Log log =
new com.samskivert.util.Log("whirled.zone");
/** Convenience function. */
public static void debug (String message)
{
log.debug(message);
}
/** Convenience function. */
public static void info (String message)
{
log.info(message);
}
/** Convenience function. */
public static void warning (String message)
{
log.warning(message);
}
/** Convenience function. */
public static void logStackTrace (Throwable t)
{
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
}
public static Logger log = Logger.getLogger("com.threerings.whirled.zone");
}
@@ -35,10 +35,11 @@ import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.data.SceneUpdate;
import com.threerings.whirled.util.WhirledContext;
import com.threerings.whirled.zone.Log;
import com.threerings.whirled.zone.data.ZoneSummary;
import com.threerings.whirled.zone.util.ZoneUtil;
import static com.threerings.whirled.zone.Log.log;
/**
* The zone director augments the scene services with the notion of zones. Zones are
* self-contained, connected groups of scenes. The normal scene director services can be used to
@@ -112,7 +113,7 @@ public class ZoneDirector extends BasicDirector
{
// make sure the zoneId and sceneId are valid
if (zoneId < 0 || sceneId < 0) {
Log.warning("Refusing moveTo(): invalid sceneId or zoneId " +
log.warning("Refusing moveTo(): invalid sceneId or zoneId " +
"[zoneId=" + zoneId + ", sceneId=" + sceneId + "].");
return false;
}
@@ -141,7 +142,7 @@ public class ZoneDirector extends BasicDirector
}
// issue a moveTo request
Log.info("Issuing zoned moveTo(" + ZoneUtil.toString(zoneId) +
log.info("Issuing zoned moveTo(" + ZoneUtil.toString(zoneId) +
", " + sceneId + ", " + sceneVers + ").");
_zservice.moveTo(_ctx.getClient(), zoneId, sceneId, sceneVers, this);
return true;
@@ -227,13 +228,13 @@ public class ZoneDirector extends BasicDirector
// just finish up what we're doing and assume that the repeated move request was the
// spurious one as it would be in the case of lag causing rapid-fire repeat requests
if (_scdir.movePending()) {
Log.info("Dropping forced move because we have a move pending " +
log.info("Dropping forced move because we have a move pending " +
"[pend=" + _scdir.getPendingModel() + ", rzId=" + zoneId +
", rsId=" + sceneId + "].");
return;
}
Log.info("Moving at request of server [zoneId=" + zoneId + ", sceneId=" + sceneId + "].");
log.info("Moving at request of server [zoneId=" + zoneId + ", sceneId=" + sceneId + "].");
// clear out our old scene and place data
_scdir.didLeaveScene();
// move to the new zone and scene
@@ -272,9 +273,8 @@ public class ZoneDirector extends BasicDirector
}
} catch (Throwable t) {
Log.warning("Zone observer choked during notification [data=" + data +
", obs=" + obs + "].");
Log.logStackTrace(t);
log.warning("Zone observer choked during notification [data=" + data +
", obs=" + obs + "].", t);
}
}
}
@@ -35,12 +35,13 @@ import com.threerings.whirled.server.SceneMoveHandler;
import com.threerings.whirled.server.SceneRegistry;
import com.threerings.whirled.server.WhirledServer;
import com.threerings.whirled.zone.Log;
import com.threerings.whirled.zone.client.ZoneService;
import com.threerings.whirled.zone.data.ZoneCodes;
import com.threerings.whirled.zone.data.ZoneSummary;
import com.threerings.whirled.zone.data.ZonedBodyObject;
import static com.threerings.whirled.zone.Log.log;
/**
* Handles transitioning between zones.
*/
@@ -74,7 +75,7 @@ public class ZoneMoveHandler extends AbstractSceneMoveHandler
// from interface ZoneManager.ResolutionListener
public void zoneFailedToResolve (int zoneId, Exception reason)
{
Log.warning("Unable to resolve zone [zoneId=" + zoneId + ", reason=" + reason + "].");
log.warning("Unable to resolve zone [zoneId=" + zoneId + ", reason=" + reason + "].");
_listener.requestFailed(ZoneCodes.NO_SUCH_ZONE);
}
@@ -36,12 +36,13 @@ import com.threerings.whirled.data.SceneUpdate;
import com.threerings.whirled.server.SceneManager;
import com.threerings.whirled.server.SceneRegistry;
import com.threerings.whirled.zone.Log;
import com.threerings.whirled.zone.client.ZoneService.ZoneMoveListener;
import com.threerings.whirled.zone.data.ZoneCodes;
import com.threerings.whirled.zone.data.ZoneSummary;
import com.threerings.whirled.zone.data.ZonedBodyObject;
import static com.threerings.whirled.zone.Log.log;
/**
* Provides zone related services which are presently the ability to move from zone to zone.
*/
@@ -74,7 +75,7 @@ public class ZoneProvider
throws InvocationException
{
if (!(caller instanceof ZonedBodyObject)) {
Log.warning("Request to switch zones by non-ZonedBodyObject " +
log.warning("Request to switch zones by non-ZonedBodyObject " +
"[clobj=" + caller.getClass() + "].");
throw new InvocationException(INTERNAL_ERROR);
}
@@ -93,7 +94,7 @@ public class ZoneProvider
// look up the zone manager for the zone
ZoneManager zmgr = _zonereg.getZoneManager(zoneId);
if (zmgr == null) {
Log.warning("Requested to enter a zone for which we have no manager " +
log.warning("Requested to enter a zone for which we have no manager " +
"[user=" + body.who() + ", zoneId=" + zoneId + "].");
throw new InvocationException(NO_SUCH_ZONE);
}
@@ -28,10 +28,11 @@ import com.threerings.presents.server.InvocationManager;
import com.threerings.crowd.server.PlaceRegistry;
import com.threerings.whirled.server.SceneRegistry;
import com.threerings.whirled.zone.Log;
import com.threerings.whirled.zone.data.ZoneCodes;
import com.threerings.whirled.zone.util.ZoneUtil;
import static com.threerings.whirled.zone.Log.log;
/**
* The zone registry takes care of mapping zone requests to the appropriate registered zone
* manager.
@@ -61,7 +62,7 @@ public class ZoneRegistry
{
ZoneManager old = (ZoneManager)_managers.get(zoneType);
if (old != null) {
Log.warning("Zone manager already registered with requested type [type=" + zoneType +
log.warning("Zone manager already registered with requested type [type=" + zoneType +
", old=" + old + ", new=" + manager + "].");
} else {
_managers.put(zoneType, manager);