commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LANG-334) Enum is not thread-safe
Date Wed, 06 Jun 2007 15:25:26 GMT

     [ https://issues.apache.org/jira/browse/LANG-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Henri Yandell updated LANG-334:
-------------------------------

    Attachment: EnumPlay.java

I made an attempt at a test, but it couldn't replicate the issue. 

> Enum is not thread-safe
> -----------------------
>
>                 Key: LANG-334
>                 URL: https://issues.apache.org/jira/browse/LANG-334
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Michael Sclafani
>             Fix For: 2.3.1
>
>         Attachments: EnumPlay.java
>
>
> Enum uses no synchronization. Even if you assume that instances are only declared statically,
the cEnumClasses map is global and can be written to when a thread triggers static initialization
of B.class while some other thread is doing getEnumList(A.class). Unsynchronized access of
a map undergoing mutation is not thread-safe.
> This isn't theoretical. We're seeing ValuedEnum.getEnum(X.class, 0) return null after
returning the correct value over 100,000 times, and then return the correct value again on
the next invocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message