Author: toad
Date: 2008-03-01 20:07:57 +0000 (Sat, 01 Mar 2008)
New Revision: 18295
Modified:
trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
Log:
Don't create a cooldown queue if we don't need one.
Modified: trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-03-01 20:03:58 UTC (rev 18294)
+++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-03-01 20:07:57 UTC (rev 18295)
@@ -187,7 +187,10 @@
} else {
offeredKeys = null;
}
+ if(!forInserts)
cooldownQueue = new RequestCooldownQueue(COOLDOWN_PERIOD);
+ else
+ cooldownQueue = null;
logMINOR = Logger.shouldLog(Logger.MINOR, this);
}
@@ -529,6 +532,7 @@
for(int i=0;i<offeredKeys.length;i++)
offeredKeys[i].remove(key);
}
+ if(cooldownQueue != null)
cooldownQueue.removeKey(key,
getter.getCooldownWakeupByKey(key));
}
@@ -599,11 +603,14 @@
if(o == null) return;
if(o instanceof SendableGet) {
gets = new SendableGet[] { (SendableGet) o };
+ if(cooldownQueue != null)
cooldownQueue.removeKey(key,
((SendableGet)o).getCooldownWakeupByKey(key));
} else {
gets = (SendableGet[]) o;
+ if(cooldownQueue != null)
for(int i=0;i<gets.length;i++)
cooldownQueue.removeKey(key,
gets[i].getCooldownWakeupByKey(key));
+
}
if(gets == null) return;
Runnable r = new Runnable() {
@@ -666,6 +673,7 @@
}
public void moveKeysFromCooldownQueue() {
+ if(cooldownQueue == null) return;
long now = System.currentTimeMillis();
Key key;
while((key = cooldownQueue.removeKeyBefore(now)) != null) {