2004-10-16 jrandom
* Increased the default minimum tunnel test time to 5 seconds, since we still see the occational message processing time spike to 2 seconds. * Update the SimpleTimer to allow rescheduling a task thats already queued (useful for the new streaming lib).
This commit is contained in:
@ -2,6 +2,7 @@ package net.i2p.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
@ -18,10 +19,14 @@ public class SimpleTimer {
|
||||
private static final SimpleTimer _instance = new SimpleTimer();
|
||||
public static SimpleTimer getInstance() { return _instance; }
|
||||
private Log _log;
|
||||
/** event time (Long) to event (TimedEvent) mapping */
|
||||
private Map _events;
|
||||
/** event (TimedEvent) to event time (Long) mapping */
|
||||
private Map _eventTimes;
|
||||
|
||||
private SimpleTimer() {
|
||||
_events = new TreeMap();
|
||||
_eventTimes = new HashMap();
|
||||
I2PThread runner = new I2PThread(new SimpleTimerRunner());
|
||||
runner.setName("SimpleTimer");
|
||||
runner.setDaemon(true);
|
||||
@ -35,9 +40,13 @@ public class SimpleTimer {
|
||||
public void addEvent(TimedEvent event, long timeoutMs) {
|
||||
long eventTime = System.currentTimeMillis() + timeoutMs;
|
||||
synchronized (_events) {
|
||||
// remove the old scheduled position, then reinsert it
|
||||
if (_eventTimes.containsKey(event))
|
||||
_events.remove(_eventTimes.get(event));
|
||||
while (_events.containsKey(new Long(eventTime)))
|
||||
eventTime++;
|
||||
_events.put(new Long(eventTime), event);
|
||||
_eventTimes.put(event, new Long(eventTime));
|
||||
_events.notifyAll();
|
||||
}
|
||||
}
|
||||
@ -87,6 +96,8 @@ public class SimpleTimer {
|
||||
if (timesToRemove.size() > 0) {
|
||||
for (int i = 0; i < timesToRemove.size(); i++)
|
||||
_events.remove(timesToRemove.get(i));
|
||||
for (int i = 0; i < eventsToFire.size(); i++)
|
||||
_eventTimes.remove(eventsToFire.get(i));
|
||||
} else {
|
||||
if (nextEventDelay != -1)
|
||||
_events.wait(nextEventDelay);
|
||||
|
@ -1,4 +1,10 @@
|
||||
$Id: history.txt,v 1.48 2004/10/14 20:20:12 jrandom Exp $
|
||||
$Id: history.txt,v 1.49 2004/10/15 12:39:19 jrandom Exp $
|
||||
|
||||
2004-10-16 jrandom
|
||||
* Increased the default minimum tunnel test time to 5 seconds, since we
|
||||
still see the occational message processing time spike to 2 seconds.
|
||||
* Update the SimpleTimer to allow rescheduling a task thats already
|
||||
queued (useful for the new streaming lib).
|
||||
|
||||
2004-10-15 jrandom
|
||||
* Replaced old minimum tunnel test timeout of 1s with a configurable
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.55 $ $Date: 2004/10/14 20:20:12 $";
|
||||
public final static String ID = "$Revision: 1.56 $ $Date: 2004/10/15 12:39:18 $";
|
||||
public final static String VERSION = "0.4.1.2";
|
||||
public final static long BUILD = 5;
|
||||
public final static long BUILD = 6;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -74,7 +74,7 @@ class TestTunnelJob extends JobImpl {
|
||||
}
|
||||
|
||||
private final static long DEFAULT_TEST_TIMEOUT = 10*1000; // 10 seconds for a test to succeed
|
||||
private final static long DEFAULT_MINIMUM_TEST_TIMEOUT = 2*1000; // 2 second min
|
||||
private final static long DEFAULT_MINIMUM_TEST_TIMEOUT = 5*1000; // 5 second min
|
||||
private final static int TEST_PRIORITY = 100;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user