Added facility for enumerating the body objects for all active users on

the server.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1274 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2002-04-18 00:44:50 +00:00
parent 76843dab59
commit 4fc5f574d8
2 changed files with 23 additions and 6 deletions
@@ -1,9 +1,9 @@
//
// $Id: CrowdServer.java,v 1.11 2002/03/28 22:32:31 mdb Exp $
// $Id: CrowdServer.java,v 1.12 2002/04/18 00:44:50 shaper Exp $
package com.threerings.crowd.server;
import java.util.HashMap;
import java.util.Iterator;
import com.threerings.presents.server.PresentsServer;
@@ -48,6 +48,17 @@ public class CrowdServer extends PresentsServer
Log.info("Crowd server initialized.");
}
/**
* Enumerates the body objects for all active users on the server.
* This should only be called from the dobjmgr thread. The caller had
* best be certain they know what they're doing, since this should
* only be necessary for use in rather special circumstances.
*/
public static Iterator enumerateBodies ()
{
return clmgr.enumerateClientObjects();
}
/**
* The server maintains a mapping of username to body object for all
* active users on the server. This should only be called from the
@@ -70,9 +81,6 @@ public class CrowdServer extends PresentsServer
}
}
/** We use this to map usernames to body objects. */
protected static HashMap _bodymap = new HashMap();
/** The config key for our list of invocation provider mappings. */
protected final static String PROVIDERS_KEY = "providers";
}
@@ -1,10 +1,11 @@
//
// $Id: ClientManager.java,v 1.14 2002/03/05 05:33:25 mdb Exp $
// $Id: ClientManager.java,v 1.15 2002/04/18 00:44:50 shaper Exp $
package com.threerings.presents.server;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import com.threerings.presents.Log;
import com.threerings.presents.data.ClientObject;
@@ -74,6 +75,14 @@ public class ClientManager implements ConnectionObserver
}
}
/**
* Enumerates all active client objects.
*/
public Iterator enumerateClientObjects ()
{
return _objmap.values().iterator();
}
/**
* Returns the client object associated with the specified username.
* This will return null unless the client object is resolved for some