forked from I2P_Developers/i2p.i2p
replace SimpleScheduler.getInstance() calls
This commit is contained in:
@@ -431,7 +431,7 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
_context.inNetMessagePool().startup();
|
||||
startupQueue();
|
||||
//_context.jobQueue().addJob(new CoalesceStatsJob(_context));
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new CoalesceStatsEvent(_context), COALESCE_TIME);
|
||||
_context.simpleScheduler().addPeriodicEvent(new CoalesceStatsEvent(_context), COALESCE_TIME);
|
||||
_context.jobQueue().addJob(new UpdateRoutingKeyModifierJob(_context));
|
||||
warmupCrypto();
|
||||
//_sessionKeyPersistenceHelper.startup();
|
||||
@@ -538,7 +538,7 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
if (blockingRebuild)
|
||||
r.timeReached();
|
||||
else
|
||||
SimpleScheduler.getInstance().addEvent(r, 0);
|
||||
_context.simpleScheduler().addEvent(r, 0);
|
||||
} catch (DataFormatException dfe) {
|
||||
_log.log(Log.CRIT, "Internal error - unable to sign our own address?!", dfe);
|
||||
}
|
||||
@@ -1348,7 +1348,7 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
*/
|
||||
private void beginMarkingLiveliness() {
|
||||
File f = getPingFile();
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new MarkLiveliness(this, f), 0, LIVELINESS_DELAY - (5*1000));
|
||||
_context.simpleScheduler().addPeriodicEvent(new MarkLiveliness(this, f), 0, LIVELINESS_DELAY - (5*1000));
|
||||
}
|
||||
|
||||
public static final String PROP_BANDWIDTH_SHARE_PERCENTAGE = "router.sharePercentage";
|
||||
|
||||
@@ -45,7 +45,7 @@ class RouterThrottleImpl implements RouterThrottle {
|
||||
_context = context;
|
||||
_log = context.logManager().getLog(RouterThrottleImpl.class);
|
||||
setTunnelStatus();
|
||||
SimpleScheduler.getInstance().addEvent(new ResetStatus(), REJECT_STARTUP_TIME + 120*1000);
|
||||
_context.simpleScheduler().addEvent(new ResetStatus(), REJECT_STARTUP_TIME + 120*1000);
|
||||
_context.statManager().createRateStat("router.throttleNetworkCause", "How lagged the jobQueue was when an I2NP was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
|
||||
//_context.statManager().createRateStat("router.throttleNetDbCause", "How lagged the jobQueue was when a networkDb request was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
|
||||
//_context.statManager().createRateStat("router.throttleTunnelCause", "How lagged the jobQueue was when a tunnel request was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
|
||||
|
||||
@@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 1;
|
||||
public final static long BUILD = 2;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
||||
@@ -446,7 +446,7 @@ class ClientConnectionRunner {
|
||||
// theirs is newer
|
||||
} else {
|
||||
// ours is newer, so wait a few secs and retry
|
||||
SimpleScheduler.getInstance().addEvent(new Rerequest(set, expirationTime, onCreateJob, onFailedJob), 3*1000);
|
||||
_context.simpleScheduler().addEvent(new Rerequest(set, expirationTime, onCreateJob, onFailedJob), 3*1000);
|
||||
}
|
||||
// fire onCreated?
|
||||
return; // already requesting
|
||||
|
||||
@@ -102,7 +102,7 @@ public class OutboundCache {
|
||||
|
||||
public OutboundCache(RouterContext ctx) {
|
||||
_context = ctx;
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new OCMOSJCacheCleaner(), CLEAN_INTERVAL, CLEAN_INTERVAL);
|
||||
_context.simpleScheduler().addPeriodicEvent(new OCMOSJCacheCleaner(), CLEAN_INTERVAL, CLEAN_INTERVAL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -416,7 +416,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
||||
private static final int LOOKUP_TIME = 30*60*1000;
|
||||
private void startGeoIP() {
|
||||
_geoIP = new GeoIP(_context);
|
||||
SimpleScheduler.getInstance().addEvent(new QueueAll(), START_DELAY);
|
||||
_context.simpleScheduler().addEvent(new QueueAll(), START_DELAY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,7 +434,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
||||
continue;
|
||||
_geoIP.add(host);
|
||||
}
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new Lookup(), 5000, LOOKUP_TIME);
|
||||
_context.simpleScheduler().addPeriodicEvent(new Lookup(), 5000, LOOKUP_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
||||
private static final int TIME_REPEAT_DELAY = 10*60*1000;
|
||||
/** @since 0.7.12 */
|
||||
private void startTimestamper() {
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new Timestamper(), TIME_START_DELAY, TIME_REPEAT_DELAY);
|
||||
_context.simpleScheduler().addPeriodicEvent(new Timestamper(), TIME_START_DELAY, TIME_REPEAT_DELAY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,7 +74,7 @@ public abstract class TransportImpl implements Transport {
|
||||
_sendPool = new ArrayList(16);
|
||||
_unreachableEntries = new HashMap(16);
|
||||
_wasUnreachableEntries = new ConcurrentHashSet(16);
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new CleanupUnreachable(), 2 * UNREACHABLE_PERIOD, UNREACHABLE_PERIOD / 2);
|
||||
_context.simpleScheduler().addPeriodicEvent(new CleanupUnreachable(), 2 * UNREACHABLE_PERIOD, UNREACHABLE_PERIOD / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -217,7 +217,7 @@ class EstablishmentManager {
|
||||
// whoops, somebody beat us to it, throw out the state we just created
|
||||
state = oldState;
|
||||
else
|
||||
SimpleScheduler.getInstance().addEvent(new Expire(to, state), 10*1000);
|
||||
_context.simpleScheduler().addEvent(new Expire(to, state), 10*1000);
|
||||
}
|
||||
}
|
||||
if (state != null) {
|
||||
@@ -465,7 +465,7 @@ class EstablishmentManager {
|
||||
msg.getTarget().getIdentity(),
|
||||
new SessionKey(addr.getIntroKey()), addr);
|
||||
_outboundStates.put(to, qstate);
|
||||
SimpleScheduler.getInstance().addEvent(new Expire(to, qstate), 10*1000);
|
||||
_context.simpleScheduler().addEvent(new Expire(to, qstate), 10*1000);
|
||||
|
||||
for (int i = 0; i < queued.size(); i++) {
|
||||
OutNetMessage m = (OutNetMessage)queued.get(i);
|
||||
@@ -544,7 +544,7 @@ class EstablishmentManager {
|
||||
dsm.setMessageExpiration(_context.clock().now()+10*1000);
|
||||
dsm.setMessageId(_context.random().nextLong(I2NPMessage.MAX_ID_VALUE));
|
||||
_transport.send(dsm, peer);
|
||||
SimpleScheduler.getInstance().addEvent(new PublishToNewInbound(peer), 0);
|
||||
_context.simpleScheduler().addEvent(new PublishToNewInbound(peer), 0);
|
||||
}
|
||||
private class PublishToNewInbound implements SimpleTimer.TimedEvent {
|
||||
private PeerState _peer;
|
||||
@@ -696,7 +696,7 @@ class EstablishmentManager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
SimpleScheduler.getInstance().addEvent(new FailIntroduction(state, nonce), INTRO_ATTEMPT_TIMEOUT);
|
||||
_context.simpleScheduler().addEvent(new FailIntroduction(state, nonce), INTRO_ATTEMPT_TIMEOUT);
|
||||
state.setIntroNonce(nonce);
|
||||
_context.statManager().addRateData("udp.sendIntroRelayRequest", 1, 0);
|
||||
UDPPacket requests[] = _builder.buildRelayRequest(_transport, state, _transport.getIntroKey());
|
||||
|
||||
@@ -158,7 +158,7 @@ class PeerTestManager {
|
||||
|
||||
sendTestToBob();
|
||||
|
||||
SimpleScheduler.getInstance().addEvent(new ContinueTest(), RESEND_TIMEOUT);
|
||||
_context.simpleScheduler().addEvent(new ContinueTest(), RESEND_TIMEOUT);
|
||||
}
|
||||
|
||||
private class ContinueTest implements SimpleTimer.TimedEvent {
|
||||
@@ -183,7 +183,7 @@ class PeerTestManager {
|
||||
// second message from Charlie yet
|
||||
sendTestToCharlie();
|
||||
}
|
||||
SimpleScheduler.getInstance().addEvent(ContinueTest.this, RESEND_TIMEOUT);
|
||||
_context.simpleScheduler().addEvent(ContinueTest.this, RESEND_TIMEOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -538,7 +538,7 @@ class PeerTestManager {
|
||||
|
||||
if (isNew) {
|
||||
_activeTests.put(Long.valueOf(nonce), state);
|
||||
SimpleScheduler.getInstance().addEvent(new RemoveTest(nonce), MAX_CHARLIE_LIFETIME);
|
||||
_context.simpleScheduler().addEvent(new RemoveTest(nonce), MAX_CHARLIE_LIFETIME);
|
||||
}
|
||||
|
||||
UDPPacket packet = _packetBuilder.buildPeerTestToBob(bobIP, from.getPort(), aliceIP, alicePort, aliceIntroKey, nonce, state.getBobCipherKey(), state.getBobMACKey());
|
||||
@@ -617,7 +617,7 @@ class PeerTestManager {
|
||||
|
||||
if (isNew) {
|
||||
_activeTests.put(Long.valueOf(nonce), state);
|
||||
SimpleScheduler.getInstance().addEvent(new RemoveTest(nonce), MAX_CHARLIE_LIFETIME);
|
||||
_context.simpleScheduler().addEvent(new RemoveTest(nonce), MAX_CHARLIE_LIFETIME);
|
||||
}
|
||||
|
||||
UDPPacket packet = _packetBuilder.buildPeerTestToCharlie(aliceIP, from.getPort(), aliceIntroKey, nonce,
|
||||
|
||||
@@ -228,7 +228,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
_context.statManager().createRateStat("udp.dropPeerDroplist", "How many peers currently have their packets dropped outright when a new peer is added to the list?", "udp", RATES);
|
||||
_context.statManager().createRateStat("udp.dropPeerConsecutiveFailures", "How many consecutive failed sends to a peer did we attempt before giving up and reestablishing a new session (lifetime is inactivity perood)", "udp", RATES);
|
||||
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new PingIntroducers(), MIN_EXPIRE_TIMEOUT * 3 / 4);
|
||||
_context.simpleScheduler().addPeriodicEvent(new PingIntroducers(), MIN_EXPIRE_TIMEOUT * 3 / 4);
|
||||
}
|
||||
|
||||
public void startup() {
|
||||
@@ -832,7 +832,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
RemoteHostId remote = peer.getRemoteHostId();
|
||||
_dropList.add(remote);
|
||||
_context.statManager().addRateData("udp.dropPeerDroplist", 1, 0);
|
||||
SimpleScheduler.getInstance().addEvent(new RemoveDropList(remote), DROPLIST_PERIOD);
|
||||
_context.simpleScheduler().addEvent(new RemoveDropList(remote), DROPLIST_PERIOD);
|
||||
}
|
||||
markUnreachable(peerHash);
|
||||
_context.shitlist().shitlistRouter(peerHash, "Part of the wrong network, version = " + ((RouterInfo) entry).getOption("router.version"));
|
||||
|
||||
@@ -42,7 +42,7 @@ class ParticipatingThrottler {
|
||||
ParticipatingThrottler(RouterContext ctx) {
|
||||
this.context = ctx;
|
||||
this.counter = new ObjectCounter();
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(), CLEAN_TIME);
|
||||
ctx.simpleScheduler().addPeriodicEvent(new Cleaner(), CLEAN_TIME);
|
||||
}
|
||||
|
||||
/** increments before checking */
|
||||
|
||||
@@ -435,7 +435,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
// don't delay the outbound if it already exists, as this opens up a large
|
||||
// race window with removeTunnels() below
|
||||
if (delayOutbound)
|
||||
SimpleScheduler.getInstance().addEvent(new DelayedStartup(outbound), 1000);
|
||||
_context.simpleScheduler().addEvent(new DelayedStartup(outbound), 1000);
|
||||
else
|
||||
outbound.startup();
|
||||
}
|
||||
@@ -523,7 +523,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
outboundSettings.setIsExploratory(true);
|
||||
outboundSettings.setIsInbound(false);
|
||||
_outboundExploratory = new TunnelPool(_context, this, outboundSettings, selector);
|
||||
SimpleScheduler.getInstance().addEvent(new DelayedStartup(_outboundExploratory), 3*1000);
|
||||
_context.simpleScheduler().addEvent(new DelayedStartup(_outboundExploratory), 3*1000);
|
||||
|
||||
// try to build up longer tunnels
|
||||
_context.jobQueue().addJob(new BootstrapPool(_context, _inboundExploratory));
|
||||
|
||||
Reference in New Issue
Block a user