Made it possible to disable client and connection managers for testing.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@609 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-11-08 05:39:51 +00:00
parent feb2a2633e
commit ff94bd7799
@@ -1,5 +1,5 @@
// //
// $Id: PresentsServer.java,v 1.15 2001/11/08 02:59:30 mdb Exp $ // $Id: PresentsServer.java,v 1.16 2001/11/08 05:39:51 mdb Exp $
package com.threerings.presents.server; package com.threerings.presents.server;
@@ -57,9 +57,11 @@ public class PresentsServer
// create our authentication manager // create our authentication manager
authmgr = new AuthManager(new DummyAuthenticator()); authmgr = new AuthManager(new DummyAuthenticator());
// create our connection manager // create our connection manager
conmgr = new ConnectionManager(config, authmgr); if (createConnectionManager()) {
// create our client manager conmgr = new ConnectionManager(config, authmgr);
clmgr = new ClientManager(conmgr); // create our client manager
clmgr = new ClientManager(conmgr);
}
// create our distributed object manager // create our distributed object manager
omgr = new PresentsDObjectMgr(); omgr = new PresentsDObjectMgr();
// create our invocation manager // create our invocation manager
@@ -117,6 +119,16 @@ public class PresentsServer
} }
} }
/**
* In local testing mode, we don't want to create a connection manager
* and listen to client connections. So we provide this method that
* can be overridden by a testing server.
*/
protected boolean createConnectionManager ()
{
return true;
}
/** /**
* Starts up all of the server services and enters the main server * Starts up all of the server services and enters the main server
* event loop. * event loop.
@@ -126,7 +138,9 @@ public class PresentsServer
// start up the auth manager // start up the auth manager
authmgr.start(); authmgr.start();
// start up the connection manager // start up the connection manager
conmgr.start(); if (conmgr != null) {
conmgr.start();
}
// invoke the dobjmgr event loop // invoke the dobjmgr event loop
omgr.run(); omgr.run();
} }
@@ -138,7 +152,9 @@ public class PresentsServer
{ {
// shut down our managers // shut down our managers
authmgr.shutdown(); authmgr.shutdown();
conmgr.shutdown(); if (conmgr != null) {
conmgr.shutdown();
}
omgr.shutdown(); omgr.shutdown();
} }