commons-issues mailing list archives

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

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

Gilles commented on MATH-757:
-----------------------------

Yes, the object is mutable; I actually meant to increase the degree of encapsulation by removing
some bells and whistles that will hardly be used (what kind of situation would need a change
of those "contraction/expansion" properties during the lifetime of the object?).
This class represents an array of primitive doubles that can adapt its size. Fine, but if
CM does not use whatever refinement can be put into such a functionality, I don't see why
we should maintain an overly complicated object. I'd guess that users would not look at CM
for this kind of utility (which belongs to e.g. "Commons Primitives"). I can understand the
existence of this class in CM given the no-dependencies requirement, but that leads us back
to my point (why maintain functionality beyond what is used internally?). Of course, I do
not suggest to remove the methods right now; just starting a discussion for 4.0. At this time,
I'm not even sure that the "synchronized" keywords can be removed (wouldn't it break compatibility?).

                
> ResizableDoubleArray is not thread-safe yet has some synch. methods
> -------------------------------------------------------------------
>
>                 Key: MATH-757
>                 URL: https://issues.apache.org/jira/browse/MATH-757
>             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: http://www.atlassian.com/software/jira

Mime
View raw message