[freenet-dev] [freenet-cvs] r16388 - trunk/freenet/src/freenet/client/async

Matthew Toseland toad at amphibian.dyndns.org
Sat Dec 8 12:48:00 UTC 2007


On Friday 07 December 2007 02:13, you wrote:
> Author: robert
> Date: 2007-12-07 02:13:36 +0000 (Fri, 07 Dec 2007)
> New Revision: 16388
> 
> Modified:
>    trunk/freenet/src/freenet/client/async/USKFetcher.java
> Log:
> Use one thread for all delayed USK checks

With regards to Timer: Why not just use the Ticker ? Admittedly they will 
sometimes get scheduled in parallel, but iirc it doesn't do that much work 
on-thread so it's not really a problem...
> 
> Modified: trunk/freenet/src/freenet/client/async/USKFetcher.java
> ===================================================================
> --- trunk/freenet/src/freenet/client/async/USKFetcher.java	2007-12-07 
01:41:35 UTC (rev 16387)
> +++ trunk/freenet/src/freenet/client/async/USKFetcher.java	2007-12-07 
02:13:36 UTC (rev 16388)
> @@ -252,43 +255,28 @@
>  			long now = System.currentTimeMillis();
>  			synchronized(this) {
>  				started = false; // don't finish before have rescheduled
> +                
> +                //Find out when we should check next ('end'), in an 
increasing delay (unless we make progress).
> +                long newSleepTime = sleepTime * 2;
> +				if(newSleepTime > maxSleepTime) newSleepTime = maxSleepTime;
> +				sleepTime = newSleepTime;
> +				end = now + sleepTime;
> +                
>  				if(valAtEnd > valueAtSchedule) {
> -					// Have advanced.
> +					// We have advanced; keep trying as if we just started.
>  					minFailures = origMinFailures;
>  					sleepTime = origSleepTime;
> +					end = now;

end = now + origSleepTime. What you have there makes it retry *immediately*.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://emu.freenetproject.org/pipermail/devl/attachments/20071208/25b678a7/attachment.pgp 


More information about the Devl mailing list