commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <Luc.Maison...@free.fr>
Subject Re: [Math] Re: svn commit: r1462504 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
Date Fri, 29 Mar 2013 17:02:12 GMT
Le 29/03/2013 17:37, Gilles a écrit :
> On Fri, 29 Mar 2013 15:48:57 -0000, luc@apache.org wrote:
>> Author: luc
>> Date: Fri Mar 29 15:48:57 2013
>> New Revision: 1462504
>>
>> URL: http://svn.apache.org/r1462504
>> Log:
>> Fixed findbugs warning.

Hi Gilles,

> 
> This one should stay.
> We agreed that "ResizableDoubleArray" should not be synchronized at the
> CM level.
> Instead of adding "synchronized" keywords, it is rather all the others
> that must
> be removed (but we decided no to do it before 4.0 in order to not break
> user code
> that potentially rely on the existing, but broken, synchronization).

We can still remove all the synchronize (including this one) for 4.0.
I don't think the fix does any harm.

Luc

> 
> Best regards,
> Gilles
> 
>>
>> Modified:
>>
>>
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
>>
>>
>> Modified:
>>
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
>>
>> URL:
>>
>> http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java?rev=1462504&r1=1462503&r2=1462504&view=diff
>>
>>
>> ==============================================================================
>>
>> ---
>>
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
>>
>> (original)
>> +++
>>
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
>>
>> Fri Mar 29 15:48:57 2013
>> @@ -934,7 +934,15 @@ public class ResizableDoubleArray implem
>>       * @since 3.1
>>       */
>>      public double compute(MathArrays.Function f) {
>> -        return f.evaluate(internalArray, startIndex, numElements);
>> +        final double[] array;
>> +        final int start;
>> +        final int num;
>> +        synchronized(this) {
>> +            array = internalArray;
>> +            start = startIndex;
>> +            num   = numElements;
>> +        }
>> +        return f.evaluate(array, start, num);
>>      }
>>
>>      /**
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message