
To use the application, you need to (by default) add the following to clients.config : # desktopgui clientApp.6.args= clientApp.6.delay=5 clientApp.6.main=desktopgui.Main clientApp.6.name=desktopgui clientApp.6.startOnLoad=true
39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
package router;
|
|
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
import net.i2p.router.RouterContext;
|
|
|
|
/**
|
|
*
|
|
* @author mathias
|
|
*/
|
|
public class RouterHandler {
|
|
public static final int SHUTDOWN_GRACEFULLY = 0;
|
|
public static void setStatus(int status) {
|
|
if(status == SHUTDOWN_GRACEFULLY) {
|
|
Thread t = new Thread(new Runnable() {
|
|
|
|
public void run() {
|
|
RouterContext context = RouterHelper.getContext();
|
|
context.router().shutdownGracefully();
|
|
while(context.router().getShutdownTimeRemaining()>0)
|
|
try {
|
|
Thread.sleep(context.router().getShutdownTimeRemaining());
|
|
} catch (InterruptedException ex) {
|
|
Logger.getLogger(RouterHandler.class.getName()).log(Level.SEVERE, null, ex);
|
|
}
|
|
System.exit(0);
|
|
}
|
|
|
|
});
|
|
t.start();
|
|
}
|
|
}
|
|
}
|