replace SimpleTimer2.getInstance() calls

This commit is contained in:
zzz
2012-08-03 16:23:31 +00:00
parent 501651125f
commit 00f9fea98c
3 changed files with 7 additions and 6 deletions

View File

@ -160,7 +160,7 @@ class PeerCoordinator implements PeerListener
// Install a timer to check the uploaders.
// Randomize the first start time so multiple tasks are spread out,
// this will help the behavior with global limits
timer = new CheckEvent(new PeerCheckerTask(_util, this));
timer = new CheckEvent(_util.getContext(), new PeerCheckerTask(_util, this));
timer.schedule((CHECK_PERIOD / 2) + _random.nextInt((int) CHECK_PERIOD));
}
@ -170,8 +170,8 @@ class PeerCoordinator implements PeerListener
*/
private static class CheckEvent extends SimpleTimer2.TimedEvent {
private final PeerCheckerTask _task;
public CheckEvent(PeerCheckerTask task) {
super(SimpleTimer2.getInstance());
public CheckEvent(I2PAppContext ctx, PeerCheckerTask task) {
super(ctx.simpleTimer2());
_task = task;
}
public void timeReached() {

View File

@ -62,7 +62,7 @@ import net.i2p.util.SimpleTimer2;
* @author Mark Wielaard (mark@klomp.org)
*/
public class TrackerClient implements Runnable {
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(TrackerClient.class);
private final Log _log;
private static final String NO_EVENT = "";
private static final String STARTED_EVENT = "started";
private static final String COMPLETED_EVENT = "completed";
@ -116,6 +116,7 @@ public class TrackerClient implements Runnable {
String id = urlencode(snark.getID());
_threadName = "TrackerClient " + id.substring(id.length() - 12);
_util = util;
_log = util.getContext().logManager().getLog(TrackerClient.class);
this.meta = meta;
this.additionalTrackerURL = additionalTrackerURL;
this.coordinator = coordinator;
@ -183,7 +184,7 @@ public class TrackerClient implements Runnable {
private class Runner extends SimpleTimer2.TimedEvent {
public Runner(long delay) {
super(SimpleTimer2.getInstance(), delay);
super(_util.getContext().simpleTimer2(), delay);
}
public void timeReached() {

View File

@ -86,7 +86,7 @@ class PeerManager {
private class Reorg extends SimpleTimer2.TimedEvent {
public Reorg() {
super(SimpleTimer2.getInstance(), REORGANIZE_TIME);
super(_context.simpleTimer2(), REORGANIZE_TIME);
}
public void timeReached() {
try {