commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MATH-505) TestUtils is thread-hostile
Date Tue, 01 Feb 2011 15:03:29 GMT

    [ https://issues.apache.org/jira/browse/MATH-505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12989232#comment-12989232
] 

Phil Steitz commented on MATH-505:
----------------------------------

Thanks, Joerg.  There should be no problems with the unit tests unless and until we introduce
different tests that actually test the pluggability.  

I thought about the additional parameter option, Sebb; but that again defeats the purpose
of this "convenience class" - you might as well just instantiate the implementation and use
it.

I think the best solution is to just make the fields final and drop the getters and setters.
 This is consistent with StatUtils.  So we should document the "hostility" issues in 2.2 and
deprecate there and drop in 3.0.

> TestUtils is thread-hostile
> ---------------------------
>
>                 Key: MATH-505
>                 URL: https://issues.apache.org/jira/browse/MATH-505
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 1.2, 2.1
>            Reporter: Sebb
>
> TestUtils has several mutable static fields which are not synchronised, or volatile.
> If one of the fields is updated by thread A, there is no guarantee that thread B will
see the full update - it may see a partially updated object.
> Furthermore, at least some of the static fields reference a mutable object, which can
be changed whilst another thread is using it.
> As far as I can tell, this class must only ever be used by a single thread otherwise
the results will be unpredictable.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message