commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <>
Subject [jira] Commented: (MATH-505) TestUtils is thread-hostile
Date Tue, 01 Feb 2011 01:14:28 GMT


Phil Steitz commented on MATH-505:

OK, I was looking at the wrong TestUtils :)

The reason for this strange-looking setup is to allow the implementations to be pluggable
at runtime.  "Hostile" is a harsh word, but this class is certainly *not* threadsafe.  Ideas
/ patches to achieve the design goal with less "hostility" would be appreciated.

I would have to double-check, but I don't think that there is any test instance state used
by the methods in this class. 

> TestUtils is thread-hostile
> ---------------------------
>                 Key: MATH-505
>                 URL:
>             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:


View raw message