use of net.i2p.router.RouterClock in project i2p.i2p by i2p.
the class BootCommSystemJob method runJob.
public void runJob() {
// The netDb and the peer manager both take a long time to start up,
// as they may have to read in ~1000 files or more each
// So turn on the multiple job queues and start these two first.
// These two (plus the current job) will consume 3 of the 4 runners,
// leaving one for everything else, which allows us to start without
// a huge job lag displayed on the console.
getContext().jobQueue().allowParallelOperation();
startupDb();
getContext().jobQueue().addJob(new BootPeerManagerJob(getContext()));
// start up the network comm system
getContext().commSystem().startup();
getContext().tunnelManager().startup();
// start I2CP
getContext().jobQueue().addJob(new StartAcceptingClientsJob(getContext()));
if (!SystemVersion.isAndroid()) {
Job j = new ReadConfigJob(getContext());
j.getTiming().setStartAfter(getContext().clock().now() + 2 * 60 * 1000);
getContext().jobQueue().addJob(j);
}
((RouterClock) getContext().clock()).addShiftListener(getContext().router());
}
use of net.i2p.router.RouterClock in project i2p.i2p by i2p.
the class Restarter method run.
public void run() {
_context.router().eventLog().addEvent(EventLog.SOFT_RESTART);
Log log = _context.logManager().getLog(Router.class);
log.error("Stopping the router for a restart...");
log.logAlways(Log.WARN, "Stopping the client manager");
// NOTE: DisconnectMessageHandler keys off "restart"
try {
_context.clientManager().shutdown("Router restart");
} catch (Throwable t) {
log.log(Log.CRIT, "Error stopping the client manager", t);
}
log.logAlways(Log.WARN, "Stopping the comm system");
_context.bandwidthLimiter().reinitialize();
try {
_context.messageRegistry().restart();
} catch (Throwable t) {
log.log(Log.CRIT, "Error restarting the message registry", t);
}
try {
_context.commSystem().restart();
} catch (Throwable t) {
log.log(Log.CRIT, "Error restarting the comm system", t);
}
log.logAlways(Log.WARN, "Stopping the tunnel manager");
try {
_context.tunnelManager().restart();
} catch (Throwable t) {
log.log(Log.CRIT, "Error restarting the tunnel manager", t);
}
// try { _context.peerManager().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the peer manager", t); }
// try { _context.netDb().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the networkDb", t); }
// try { _context.jobQueue().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the job queue", t); }
log.logAlways(Log.WARN, "Router teardown complete, restarting the router...");
try {
Thread.sleep(10 * 1000);
} catch (InterruptedException ie) {
}
log.logAlways(Log.WARN, "Restarting the comm system");
log.logAlways(Log.WARN, "Restarting the tunnel manager");
log.logAlways(Log.WARN, "Restarting the client manager");
try {
_context.clientMessagePool().restart();
} catch (Throwable t) {
log.log(Log.CRIT, "Error restarting the CMP", t);
}
try {
_context.clientManager().startup();
} catch (Throwable t) {
log.log(Log.CRIT, "Error starting the client manager", t);
}
_context.router().setIsAlive();
_context.router().rebuildRouterInfo();
log.logAlways(Log.WARN, "Restart complete");
((RouterClock) _context.clock()).addShiftListener(_context.router());
}
Aggregations