commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Madden <jason.mad...@riskmetrics.com>
Subject LANG-334 Enum is not thread-safe
Date Fri, 27 Jul 2007 15:22:36 GMT
(I was utterly unsuccessful this morning in posting a comment or a  
patch to the issue in jira, receiving JS errors and server-side  
NullPointerExceptions all over the place, so please forgive me for  
emailing the list directly.)

We have also encountered the issue of thread safety in the Enum  
class. In our case, it shows up when running in a application server  
where there are many threads and other applications are loading  
classes at arbitrary times.

I've attached the patch that we are using which seems to correct this  
issue for us. Rather than synchronize all access to the cEnumClasses  
map (which seems like it would be rather expensive and highly  
contended), we adopted a copy-on-write approach that only involves  
synchronization when new classes are loaded.

Jason


Mime
View raw message