On Monday 14 April 2008 03:42, j16sdiz at freenetproject.org wrote:
> Author: j16sdiz
> Date: 2008-04-14 02:42:33 +0000 (Mon, 14 Apr 2008)
> New Revision: 19290
> 
> Modified:
>    trunk/freenet/src/freenet/support/math/TrivialRunningAverage.java
> Log:
> findbugs: synchronization

Wouldn't it be better to synchronize in the copy constructor?
> 
> 
> Modified: trunk/freenet/src/freenet/support/math/TrivialRunningAverage.java
> ===================================================================
> --- trunk/freenet/src/freenet/support/math/TrivialRunningAverage.java 
2008-04-14 02:42:07 UTC (rev 19289)
> +++ trunk/freenet/src/freenet/support/math/TrivialRunningAverage.java 
2008-04-14 02:42:33 UTC (rev 19290)
> @@ -40,7 +40,9 @@
>       }
>  
>      public Object clone() {
> -     return new TrivialRunningAverage(this);
> +     synchronized (this) {
> +                     return new TrivialRunningAverage(this);
> +             }
>      }
>  
>       
> 
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> 
> 
-------------- 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/20080414/d2a80113/attachment.pgp>

Reply via email to