commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <>
Subject [jira] [Commented] (MATH-757) ResizableDoubleArray is not thread-safe yet has some synch. methods
Date Tue, 23 Oct 2012 19:55:12 GMT


Phil Steitz commented on MATH-757:

Good catch on the extraneous should Contract above.  That only has relevance in the addElementRolling
method, so I would see the above change as safe.

On the other point, I disagree.  This class is by nature mutable - it maintains a dynamic
data structure.  To make it threadsafe, we would have to protect all of the data members.
 The protected methods are there to allow subclasses to override specific behaviors.  Eliminating
mutability of exposed properties limits the functionality of the class.  We don't use that
mutability now in [math], but the class is public and others may use it.  The key point is
that making things like expansion factor and expansion mode immutable does little / nothing
to move toward threadsafety, while limiting functionality.
> ResizableDoubleArray is not thread-safe yet has some synch. methods
> -------------------------------------------------------------------
>                 Key: MATH-757
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.1
> ResizableDoubleArray has several synchronised methods, but is not thread-safe, because
class variables are not always accessed using the lock.
> Is the class supposed to be thread-safe?
> If so, all accesses (read and write) need to be synch.
> If not, the synch. qualifiers could be dropped.
> In any case, the protected fields need to be made private.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message