#1069: Deprecated SimpleScheduler and moved functionality into SimpleTimer2

This commit is contained in:
dev
2015-04-06 21:05:24 +00:00
parent 4d8e577ffd
commit facbe8f9a0
34 changed files with 149 additions and 51 deletions

View File

@ -5,8 +5,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import net.i2p.data.Hash;
import net.i2p.util.ObjectCounter;
import net.i2p.util.RandomSource;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer;
import net.i2p.util.SimpleTimer2;
/**
* Count how often we have received an incoming connection
@ -33,7 +33,7 @@ class ConnThrottler {
// shorten the initial period by a random amount
// to prevent correlation across destinations
// and identification of router startup time
SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(),
SimpleTimer2.getInstance().addPeriodicEvent(new Cleaner(),
(period / 2) + RandomSource.getInstance().nextLong(period / 2),
period);
}

View File

@ -781,7 +781,7 @@ class Connection {
private boolean scheduleDisconnectEvent() {
if (!_disconnectScheduledOn.compareAndSet(0, _context.clock().now()))
return false;
_context.simpleScheduler().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
_context.simpleTimer2().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
return true;
}

View File

@ -213,7 +213,7 @@ class ConnectionPacketHandler {
final long delay = nextSendTime - now;
if (_log.shouldLog(Log.DEBUG))
_log.debug("scheduling ack in "+delay);
_context.simpleScheduler().addEvent(new AckDup(con), delay);
_context.simpleTimer2().addEvent(new AckDup(con), delay);
}
} else {

View File

@ -16,7 +16,7 @@ abstract class SchedulerImpl implements TaskScheduler {
}
protected void reschedule(long msToWait, Connection con) {
_context.simpleScheduler().addEvent(con.getConnectionEvent(), msToWait);
_context.simpleTimer2().addEvent(con.getConnectionEvent(), msToWait);
}
@Override