Actually instead of doing the necessary jiggery pokery to make PresentsServer

subclasses provide PresentsServer "services" we'll just have no PresentsServer
services. All services will be provided by components and the server will
disappear in a puff of inversion of control.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5155 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-06-07 18:57:04 +00:00
parent c568204bbb
commit fce06c52c5
6 changed files with 45 additions and 40 deletions
@@ -51,6 +51,7 @@ import static com.threerings.presents.Log.log;
*/
@Singleton
public class PresentsServer
implements ShutdownManager.Shutdowner
{
/** Configures dependencies needed by the Presents services. */
public static class Module extends AbstractModule
@@ -141,6 +142,9 @@ public class PresentsServer
injector.getInstance(NativeSignalHandler.class).init();
}
// register with the shutdown manager to provide legacy centralized shutdown support
_shutmgr.registerShutdowner(this);
// configure the dobject manager with our access controller
_omgr.setDefaultAccessController(createDefaultObjectAccessController());
@@ -221,36 +225,9 @@ public class PresentsServer
omgr.run();
}
/**
* Requests that the server shut down. All registered shutdown participants will be shut down,
* following which the server process will be terminated.
*/
// from interface ShutdownManager.Shutdowner
public void shutdown ()
{
// shutdown all registered shutdowners
_shutmgr.shutdown();
// shut down the connection manager (this will cease all network activity but not actually
// close the connections)
if (_conmgr.isRunning()) {
_conmgr.shutdown();
}
// finally shut down the invoker and dobj manager (The invoker does both for us.)
invoker.shutdown();
}
/**
* Queues up a request to shutdown on the dobjmgr thread. This method may be safely called from
* any thread.
*/
public void queueShutdown ()
{
omgr.postRunnable(new Runnable() {
public void run () {
shutdown();
}
});
}
/**