* add "dump threads"

* hook in to the service manager and let it know we're exiting gracefully (when appropriate)
* commented out but generally functional systray integration.  i cant get it to build sometimes though, something is b0rking up
This commit is contained in:
jrandom
2004-08-23 21:32:24 +00:00
committed by zzz
parent 3c62a5d2b4
commit 54aa0fdb11
3 changed files with 38 additions and 6 deletions

View File

@ -1,6 +1,10 @@
package net.i2p.router.web;
import net.i2p.router.ClientTunnelSettings;
import net.i2p.router.Router;
//import net.i2p.apps.systray.SysTray;
import org.tanukisoftware.wrapper.WrapperManager;
/**
* Handler to deal with form submissions from the service config form and act
@ -14,14 +18,25 @@ public class ConfigServiceHandler extends FormHandler {
if (_action == null) return;
if ("Shutdown gracefully".equals(_action)) {
WrapperManager.signalStopped(Router.EXIT_GRACEFUL);
_context.router().shutdownGracefully();
addFormNotice("Graceful shutdown initiated");
} else if ("Shutdown immediately".equals(_action)) {
_context.router().shutdown();
WrapperManager.signalStopped(Router.EXIT_HARD);
_context.router().shutdown(Router.EXIT_HARD);
addFormNotice("Shutdown immediately! boom bye bye bad bwoy");
} else if ("Cancel graceful shutdown".equals(_action)) {
_context.router().cancelGracefulShutdown();
addFormNotice("Graceful shutdown cancelled");
} else if ("Dump threads".equals(_action)) {
WrapperManager.requestThreadDump();
addFormNotice("Threads dumped to logs/wrapper.log");
//} else if ("Show systray icon".equals(_action)) {
// SysTray.instance().show();
// addFormNotice("Systray icon enabled (if possible)");
//} else if ("Hide systray icon".equals(_action)) {
// SysTray.instance().hide();
// addFormNotice("Systray icon disabled");
} else {
addFormNotice("Blah blah blah. whatever. I'm not going to " + _action);
}