Router: Minor cleanup, remove some deprecated and small methods

This commit is contained in:
zzz
2015-10-02 13:45:42 +00:00
parent b068f9a262
commit f93da93cf0

View File

@@ -62,7 +62,7 @@ import net.i2p.util.Translate;
/**
* Main driver for the router.
*
* For embedded use, instantiate and then call runRouter().
* For embedded use, instantiate, call setKillVMOnEnd(false), and then call runRouter().
*
*/
public class Router implements RouterClock.ClockShiftListener {
@@ -77,7 +77,6 @@ public class Router implements RouterClock.ClockShiftListener {
public final Object routerInfoFileLock = new Object();
private final Object _configFileLock = new Object();
private long _started;
private boolean _higherVersionSeen;
private boolean _killVMOnEnd;
private int _gracefulExitCode;
private I2PThread.OOMEventListener _oomListener;
@@ -392,7 +391,6 @@ public class Router implements RouterClock.ClockShiftListener {
CryptoChecker.warnUnavailableCrypto(_context);
_routerInfo = null;
_higherVersionSeen = false;
if (_log.shouldLog(Log.INFO))
_log.info("New router created with config file " + _configFilename);
_oomListener = new OOMListener(_context);
@@ -510,20 +508,6 @@ public class Router implements RouterClock.ClockShiftListener {
_context.jobQueue().addJob(new PersistRouterInfoJob(_context));
}
/**
* True if the router has tried to communicate with another router who is running a higher
* incompatible protocol version.
* @deprecated unused
*/
public boolean getHigherVersionSeen() { return _higherVersionSeen; }
/**
* True if the router has tried to communicate with another router who is running a higher
* incompatible protocol version.
* @deprecated unused
*/
public void setHigherVersionSeen(boolean seen) { _higherVersionSeen = seen; }
/**
* Used only by routerconsole.. to be deprecated?
*/
@@ -577,7 +561,9 @@ public class Router implements RouterClock.ClockShiftListener {
if (!SystemVersion.isAndroid())
I2PThread.addOOMEventListener(_oomListener);
setupHandlers();
// message handlers
_context.inNetMessagePool().registerHandlerJobBuilder(GarlicMessage.MESSAGE_TYPE, new GarlicMessageHandler(_context));
//if (ALLOW_DYNAMIC_KEYS) {
// if ("true".equalsIgnoreCase(_context.getProperty(Router.PROP_HIDDEN, "false")))
// killKeys();
@@ -586,7 +572,7 @@ public class Router implements RouterClock.ClockShiftListener {
_context.messageValidator().startup();
_context.tunnelDispatcher().startup();
_context.inNetMessagePool().startup();
startupQueue();
_context.jobQueue().runQueue(1);
//_context.jobQueue().addJob(new CoalesceStatsJob(_context));
_context.simpleTimer2().addPeriodicEvent(new CoalesceStatsEvent(_context), COALESCE_TIME);
_context.jobQueue().addJob(new UpdateRoutingKeyModifierJob(_context));
@@ -1080,15 +1066,6 @@ public class Router implements RouterClock.ClockShiftListener {
saveConfig(PROP_JBIGI, loaded);
}
private void startupQueue() {
_context.jobQueue().runQueue(1);
}
private void setupHandlers() {
_context.inNetMessagePool().registerHandlerJobBuilder(GarlicMessage.MESSAGE_TYPE, new GarlicMessageHandler(_context));
//_context.inNetMessagePool().registerHandlerJobBuilder(TunnelMessage.MESSAGE_TYPE, new TunnelMessageHandler(_context));
}
/** shut down after all tunnels are gone */
public static final int EXIT_GRACEFUL = 2;
/** shut down immediately */
@@ -1582,7 +1559,7 @@ public class Router implements RouterClock.ClockShiftListener {
if (f.exists()) {
long lastWritten = f.lastModified();
if (System.currentTimeMillis()-lastWritten > LIVELINESS_DELAY) {
System.err.println("WARN: Old router was not shut down gracefully, deleting router.ping");
System.err.println("WARN: Old router was not shut down gracefully, deleting " + f);
f.delete();
} else {
return false;