Allow subclasses to change how signal handlers are registered

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6132 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Charlie Groves
2010-08-23 22:28:29 +00:00
parent 8818511502
commit 543a0d8a57
2 changed files with 16 additions and 11 deletions
@@ -80,7 +80,7 @@ public class ClientManager
}
/**
* Used by entites that wish to track when clients initiate and end sessions on this server.
* Used by entities that wish to track when clients initiate and end sessions on this server.
*/
public static interface ClientObserver
{
@@ -130,16 +130,7 @@ public class PresentsServer
SystemInfo si = new SystemInfo();
log.info("Starting up server", "os", si.osToString(), "jvm", si.jvmToString());
// register SIGTERM, SIGINT (ctrl-c) and a SIGHUP handlers
boolean registered = false;
try {
registered = injector.getInstance(SunSignalHandler.class).init();
} catch (Throwable t) {
log.warning("Unable to register Sun signal handlers", "error", t);
}
if (!registered) {
injector.getInstance(NativeSignalHandler.class).init();
}
registerSignalHandlers(injector);
// initialize our deprecated legacy static references
omgr = _omgr;
@@ -172,6 +163,20 @@ public class PresentsServer
_lifecycle.init();
}
protected void registerSignalHandlers (Injector injector)
{
// register SIGTERM, SIGINT (ctrl-c) and a SIGHUP handlers
boolean registered = false;
try {
registered = injector.getInstance(SunSignalHandler.class).init();
} catch (Throwable t) {
log.warning("Unable to register Sun signal handlers", "error", t);
}
if (!registered) {
injector.getInstance(NativeSignalHandler.class).init();
}
}
/**
* Starts up all of the server services and enters the main server event loop.
*/