Finished wiring up oid list tracking; made shutdown() work on the cher

server; added an easy mechanism to write test modules and invoke them on
the server.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@192 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-08 00:28:49 +00:00
parent 91d5813b37
commit 6fe9ad8a6e
7 changed files with 410 additions and 24 deletions
@@ -1,5 +1,5 @@
//
// $Id: PresentsServer.java,v 1.9 2001/07/19 21:29:01 mdb Exp $
// $Id: PresentsServer.java,v 1.10 2001/08/08 00:28:49 mdb Exp $
package com.threerings.cocktail.cher.server;
@@ -132,15 +132,49 @@ public class CherServer
// start up the connection manager
conmgr.start();
// invoke the dobjmgr event loop
((CherDObjectMgr)omgr).run();
omgr.run();
}
/**
* Requests that the server shut down.
*/
public static void shutdown ()
{
// shut down our managers
authmgr.shutdown();
conmgr.shutdown();
omgr.shutdown();
}
public static void main (String[] args)
{
Log.info("Cher server starting...");
CherServer server = new CherServer();
try {
// initialize the server
server.init();
// check to see if we should load and invoke a test module
// before running the server
String testmod = System.getProperty("test_module");
if (testmod != null) {
try {
Log.info("Invoking test module [mod=" + testmod + "].");
Class tmclass = Class.forName(testmod);
Runnable trun = (Runnable)tmclass.newInstance();
trun.run();
} catch (Exception e) {
Log.warning("Unable to invoke test module " +
"[mod=" + testmod + "].");
Log.logStackTrace(e);
}
}
// start the server to running (this method call won't return
// until the server is shut down)
server.run();
} catch (Exception e) {
Log.warning("Unable to initialize server.");
Log.logStackTrace(e);