Report to the caller (by excepting) when a cluster is full; demoted log
messages to debug. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2339 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SpotCodes.java,v 1.5 2003/03/27 00:10:29 mdb Exp $
|
||||
// $Id: SpotCodes.java,v 1.6 2003/03/27 16:45:30 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.spot.data;
|
||||
|
||||
@@ -29,6 +29,10 @@ public interface SpotCodes extends ChatCodes, SceneCodes
|
||||
* generated by a failed joinCluster request. */
|
||||
public static final String NO_SUCH_CLUSTER = "m.no_such_cluster";
|
||||
|
||||
/** An error code indicating that a cluster is full. Usually generated
|
||||
* by a failed joinCluster request. */
|
||||
public static final String CLUSTER_FULL = "m.cluster_full";
|
||||
|
||||
/** The chat type code with which we register our cluster auxiliary
|
||||
* chat objects. Chat display implementations should interpret chat
|
||||
* messages with this type accordingly. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SpotSceneManager.java,v 1.35 2003/03/27 16:04:26 mdb Exp $
|
||||
// $Id: SpotSceneManager.java,v 1.36 2003/03/27 16:45:30 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.spot.server;
|
||||
|
||||
@@ -148,8 +148,8 @@ public class SpotSceneManager extends SceneManager
|
||||
entry = _sscene.getDefaultEntrance();
|
||||
}
|
||||
|
||||
// Log.info("Positioning entering body [who=" + body.who() +
|
||||
// ", where=" + entry.getOppLocation() + "].");
|
||||
Log.debug("Positioning entering body [who=" + body.who() +
|
||||
", where=" + entry.getOppLocation() + "].");
|
||||
|
||||
// create a scene location for them located on the entrance portal
|
||||
// but facing the opposite direction
|
||||
@@ -266,8 +266,8 @@ public class SpotSceneManager extends SceneManager
|
||||
|
||||
// otherwise we create a new cluster and add our charter members!
|
||||
clrec = new ClusterRecord();
|
||||
clrec.addBody(friend);
|
||||
clrec.addBody(joiner);
|
||||
clrec.addBody(friend);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -359,12 +359,13 @@ public class SpotSceneManager extends SceneManager
|
||||
}
|
||||
|
||||
public boolean addBody (BodyObject body)
|
||||
throws InvocationException
|
||||
{
|
||||
if (!(body instanceof ClusteredBodyObject)) {
|
||||
Log.warning("Refusing to add non-clustered body to cluster " +
|
||||
"[cloid=" + _clobj.getOid() +
|
||||
", size=" + size() + ", who=" + body.who() + "].");
|
||||
return false;
|
||||
throw new InvocationException(INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
// if they're already in the cluster, do nothing
|
||||
@@ -374,10 +375,13 @@ public class SpotSceneManager extends SceneManager
|
||||
|
||||
// make sure we can add this body
|
||||
if (!canAddBody(this, body)) {
|
||||
Log.info("Cluster full, refusing growth " + this + ".");
|
||||
return false;
|
||||
Log.debug("Cluster full, refusing growth " + this + ".");
|
||||
throw new InvocationException(CLUSTER_FULL);
|
||||
}
|
||||
|
||||
// make sure our intrepid joiner is not in any another cluster
|
||||
removeFromCluster(body.getOid());
|
||||
|
||||
put(body.getOid(), body);
|
||||
try {
|
||||
body.startTransaction();
|
||||
@@ -396,7 +400,7 @@ public class SpotSceneManager extends SceneManager
|
||||
_ssobj.commitTransaction();
|
||||
}
|
||||
|
||||
Log.info("Added " + body.who() + " to "+ this + ".");
|
||||
Log.debug("Added " + body.who() + " to "+ this + ".");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -426,7 +430,7 @@ public class SpotSceneManager extends SceneManager
|
||||
body.commitTransaction();
|
||||
}
|
||||
|
||||
Log.info("Removed " + bodyOid + " from "+ this + ".");
|
||||
Log.debug("Removed " + bodyOid + " from "+ this + ".");
|
||||
|
||||
// if we've removed our last body; stick a fork in ourselves
|
||||
if (size() == 0) {
|
||||
@@ -489,8 +493,8 @@ public class SpotSceneManager extends SceneManager
|
||||
|
||||
protected void destroy ()
|
||||
{
|
||||
Log.info("Cluster empty, going away " +
|
||||
"[cloid=" + _clobj.getOid() + "].");
|
||||
Log.debug("Cluster empty, going away " +
|
||||
"[cloid=" + _clobj.getOid() + "].");
|
||||
_ssobj.removeFromClusters(_cluster.getKey());
|
||||
_clusters.remove(_clobj.getOid());
|
||||
CrowdServer.omgr.destroyObject(_clobj.getOid());
|
||||
|
||||
Reference in New Issue
Block a user