forked from I2P_Developers/i2p.i2p
put the adminManager in the context so we can control it (and in turn, restart it)
This commit is contained in:
@ -154,6 +154,7 @@ public class Router {
|
|||||||
warmupCrypto();
|
warmupCrypto();
|
||||||
_sessionKeyPersistenceHelper.startup();
|
_sessionKeyPersistenceHelper.startup();
|
||||||
_context.jobQueue().addJob(new StartupJob(_context));
|
_context.jobQueue().addJob(new StartupJob(_context));
|
||||||
|
_context.adminManager().startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAlive() { return _isAlive; }
|
public boolean isAlive() { return _isAlive; }
|
||||||
@ -493,6 +494,7 @@ public class Router {
|
|||||||
_isAlive = false;
|
_isAlive = false;
|
||||||
I2PThread.removeOOMEventListener(_oomListener);
|
I2PThread.removeOOMEventListener(_oomListener);
|
||||||
try { _context.jobQueue().shutdown(); } catch (Throwable t) { _log.log(Log.CRIT, "Error shutting down the job queue", t); }
|
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.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.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); }
|
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;
|
_isAlive = false;
|
||||||
|
|
||||||
try { _context.commSystem().restart(); } catch (Throwable t) { _log.log(Log.CRIT, "Error restarting the comm system", t); }
|
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.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.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.peerManager().restart(); } catch (Throwable t) { _log.log(Log.CRIT, "Error restarting the peer manager", t); }
|
||||||
|
@ -6,6 +6,7 @@ import java.util.Properties;
|
|||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.data.Hash;
|
import net.i2p.data.Hash;
|
||||||
|
import net.i2p.router.admin.AdminManager;
|
||||||
import net.i2p.router.client.ClientManagerFacadeImpl;
|
import net.i2p.router.client.ClientManagerFacadeImpl;
|
||||||
import net.i2p.router.networkdb.kademlia.KademliaNetworkDatabaseFacade;
|
import net.i2p.router.networkdb.kademlia.KademliaNetworkDatabaseFacade;
|
||||||
import net.i2p.router.peermanager.Calculator;
|
import net.i2p.router.peermanager.Calculator;
|
||||||
@ -33,6 +34,7 @@ import net.i2p.router.tunnelmanager.PoolingTunnelManagerFacade;
|
|||||||
*/
|
*/
|
||||||
public class RouterContext extends I2PAppContext {
|
public class RouterContext extends I2PAppContext {
|
||||||
private Router _router;
|
private Router _router;
|
||||||
|
private AdminManager _adminManager;
|
||||||
private ClientManagerFacade _clientManagerFacade;
|
private ClientManagerFacade _clientManagerFacade;
|
||||||
private ClientMessagePool _clientMessagePool;
|
private ClientMessagePool _clientMessagePool;
|
||||||
private JobQueue _jobQueue;
|
private JobQueue _jobQueue;
|
||||||
@ -69,6 +71,7 @@ public class RouterContext extends I2PAppContext {
|
|||||||
_contexts.add(this);
|
_contexts.add(this);
|
||||||
}
|
}
|
||||||
private void initAll() {
|
private void initAll() {
|
||||||
|
_adminManager = new AdminManager(this);
|
||||||
_clientManagerFacade = new ClientManagerFacadeImpl(this);
|
_clientManagerFacade = new ClientManagerFacadeImpl(this);
|
||||||
_clientMessagePool = new ClientMessagePool(this);
|
_clientMessagePool = new ClientMessagePool(this);
|
||||||
_jobQueue = new JobQueue(this);
|
_jobQueue = new JobQueue(this);
|
||||||
@ -112,7 +115,12 @@ public class RouterContext extends I2PAppContext {
|
|||||||
public Router router() { return _router; }
|
public Router router() { return _router; }
|
||||||
/** convenience method for querying the router's ident */
|
/** convenience method for querying the router's ident */
|
||||||
public Hash routerHash() { return _router.getRouterInfo().getIdentity().getHash(); }
|
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?
|
* How are we coordinating clients for the router?
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,6 @@ package net.i2p.router.startup;
|
|||||||
|
|
||||||
import net.i2p.router.JobImpl;
|
import net.i2p.router.JobImpl;
|
||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
import net.i2p.router.admin.AdminManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The StartupJob should be run once on router startup to initialize the system
|
* 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 String getName() { return "Startup Router"; }
|
||||||
public void runJob() {
|
public void runJob() {
|
||||||
ReadConfigJob.doRead(getContext());
|
ReadConfigJob.doRead(getContext());
|
||||||
new AdminManager(getContext()).startup();
|
|
||||||
getContext().jobQueue().addJob(new LoadClientAppsJob(getContext()));
|
getContext().jobQueue().addJob(new LoadClientAppsJob(getContext()));
|
||||||
getContext().statPublisher().startup();
|
getContext().statPublisher().startup();
|
||||||
getContext().jobQueue().addJob(new LoadRouterInfoJob(getContext()));
|
getContext().jobQueue().addJob(new LoadRouterInfoJob(getContext()));
|
||||||
|
Reference in New Issue
Block a user