commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CSV-34) CSVFormat describes itself as immutable, but it is not - in particular it is not thread-safe
Date Sun, 11 Mar 2012 23:10:39 GMT

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

Emmanuel Bourg commented on CSV-34:
-----------------------------------

Eventually I removed the volatile modifier, it was slowing the parser by about 5% in my tests.
I replaced the clones by a constructor call as you suggested.
                
> CSVFormat describes itself as immutable, but it is not - in particular it is not thread-safe
> --------------------------------------------------------------------------------------------
>
>                 Key: CSV-34
>                 URL: https://issues.apache.org/jira/browse/CSV-34
>             Project: Commons CSV
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 1.0
>
>         Attachments: CSVFormat.java
>
>
> CSVFormat describes itself as immutable, but it is not @Immutable - the class fields
are all mutable.
> The methods that change the fields do so by creating a clone, and returning the changed
clone.
> So in a sense the class is immutable.
> However, the normal expectation is that @Immutable classes are @ThreadSafe.
> CSVFormat is not thread-safe, because the fields are not volatile, and the fields are
not written & read using a common lock.
> The comment needs to be clarified or removed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message