On Friday 15 August 2008 20:22, nextgens at freenetproject.org wrote:
> Author: nextgens
> Date: 2008-08-15 19:22:32 +0000 (Fri, 15 Aug 2008)
> New Revision: 21916
> 
> Modified:
>    trunk/freenet/src/freenet/node/PeerNode.java
> Log:
> PeerNode.getNumberOfSelections() is definitly too time consuming... and that 
makes PacketSender to freeze for to long

Ewwwww! Can't we just return the count? Or better yet, count the selections in 
some way that doesn't require two objects for every hit? Admittedly that 
would mean we could no longer get the number of selections in a given time 
period, but stuff based on that tends to cause oscillations...
> 
> Modified: trunk/freenet/src/freenet/node/PeerNode.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/PeerNode.java      2008-08-15 19:05:51 UTC 
(rev 21915)
> +++ trunk/freenet/src/freenet/node/PeerNode.java      2008-08-15 19:22:32 UTC 
(rev 21916)
> @@ -3984,8 +3984,9 @@
>       }
>       
>       public SortedSet<Long> getNumberOfSelections() {
> +             // FIXME: returning a copy is not an option: find a smarter way 
> of 
dealing with the synchronization
>               synchronized(numberOfSelectionsSync) {
> -                     return new TreeSet<Long>(numberOfSelections);
> +                     return numberOfSelections;
>               }
>       }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20080822/e801cd80/attachment.pgp>

Reply via email to