put the adminManager in the context so we can control it (and in turn, restart it)

This commit is contained in:
jrandom
2004-07-31 04:15:09 +00:00
committed by zzz
parent 8f46ead756
commit 21126f766c
3 changed files with 12 additions and 3 deletions

View File

@ -154,6 +154,7 @@ public class Router {
warmupCrypto();
_sessionKeyPersistenceHelper.startup();
_context.jobQueue().addJob(new StartupJob(_context));
_context.adminManager().startup();
}
public boolean isAlive() { return _isAlive; }
@ -493,6 +494,7 @@ public class Router {
_isAlive = false;
I2PThread.removeOOMEventListener(_oomListener);
try { _context.jobQueue().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the job queue", t); }
try { _context.adminManager().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the admin manager", t); }
try { _context.statPublisher().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the stats manager", t); }
try { _context.clientManager().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the client manager", t); }
try { _context.tunnelManager().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the tunnel manager", t); }
@ -537,6 +539,7 @@ public class Router {
_isAlive = false;
try { _context.commSystem().restart(); } catch (Throwable t) { _log.log(Log.CRIT, "Error restarting the comm system", t); }
try { _context.adminManager().restart(); } catch (Throwable t) { _log.log(Log.CRIT, "Error restarting the client manager", t); }
try { _context.clientManager().restart(); } catch (Throwable t) { _log.log(Log.CRIT, "Error restarting the client manager", t); }
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); }

View File

@ -6,6 +6,7 @@ import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.data.Hash;
import net.i2p.router.admin.AdminManager;
import net.i2p.router.client.ClientManagerFacadeImpl;
import net.i2p.router.networkdb.kademlia.KademliaNetworkDatabaseFacade;
import net.i2p.router.peermanager.Calculator;
@ -33,6 +34,7 @@ import net.i2p.router.tunnelmanager.PoolingTunnelManagerFacade;
*/
public class RouterContext extends I2PAppContext {
private Router _router;
private AdminManager _adminManager;
private ClientManagerFacade _clientManagerFacade;
private ClientMessagePool _clientMessagePool;
private JobQueue _jobQueue;
@ -69,6 +71,7 @@ public class RouterContext extends I2PAppContext {
_contexts.add(this);
}
private void initAll() {
_adminManager = new AdminManager(this);
_clientManagerFacade = new ClientManagerFacadeImpl(this);
_clientMessagePool = new ClientMessagePool(this);
_jobQueue = new JobQueue(this);
@ -112,7 +115,12 @@ public class RouterContext extends I2PAppContext {
public Router router() { return _router; }
/** convenience method for querying the router's ident */
public Hash routerHash() { return _router.getRouterInfo().getIdentity().getHash(); }
/**
* Controls a basic admin interface
*
*/
public AdminManager adminManager() { return _adminManager; }
/**
* How are we coordinating clients for the router?
*/

View File

@ -11,7 +11,6 @@ package net.i2p.router.startup;
import net.i2p.router.JobImpl;
import net.i2p.router.RouterContext;
import net.i2p.router.admin.AdminManager;
/**
* The StartupJob should be run once on router startup to initialize the system
@ -35,7 +34,6 @@ public class StartupJob extends JobImpl {
public String getName() { return "Startup Router"; }
public void runJob() {
ReadConfigJob.doRead(getContext());
new AdminManager(getContext()).startup();
getContext().jobQueue().addJob(new LoadClientAppsJob(getContext()));
getContext().statPublisher().startup();
getContext().jobQueue().addJob(new LoadRouterInfoJob(getContext()));