[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wink-dev
Subject:    [jira] Commented: (WINK-255) Iterator over map of SoftReferences
From:       "Hudson (JIRA)" <jira () apache ! org>
Date:       2010-02-20 20:40:27
Message-ID: 1344301835.414501266698427995.JavaMail.jira () brutus ! apache ! org
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/WINK-255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12836261#action_12836261 \
] 

Hudson commented on WINK-255:
-----------------------------

Integrated in Wink-Trunk-JDK1.5 #266 (See \
[http://hudson.zones.apache.org/hudson/job/Wink-Trunk-JDK1.5/266/])  : protect \
against ConcurrentModificationException when garbage collector thread tries to clean \
up SoftReferences in the WeakHashMap


> Iterator over map of SoftReferences susceptible to ConcurrentModificationException
> ----------------------------------------------------------------------------------
> 
> Key: WINK-255
> URL: https://issues.apache.org/jira/browse/WINK-255
> Project: Wink
> Issue Type: Bug
> Components: Common
> Affects Versions: 1.1
> Reporter: Mike Rheinheimer
> Fix For: 1.1
> 
> Attachments: WINK-255.patch
> 
> 
> In org/apache/wink/common/internal/utils/SoftConcurrentMap.put, a copy of the map \
> is made by calling the WeakHashMap(Map) copy constructor.   Under the \
> WeakHashMap(Map) constructor, java.util.AbstractMap.putAll is called, which uses an \
> iterator.  Iterators, as we all know, are not thread-safe; they are susceptible to \
> ConcurrentModificationExceptions.  Note that this method is already 'synchronized'. \
> However, that does not protect this.map from the silent garbage collector thread, \
> which may remove something at any time due to the internal values being \
> "SoftReferences".  Instead of synchronizing on this.map, let's just catch \
> ConcurrentModificationException ignore it, and retry in the while loop. Please see \
> the patch.  I have tested this many times in a multi-threaded environment, and even \
> done performance testing on it.  The fix looks good.  However, I'll leave it up for \
> a few days in case anyone has a better idea before I commit it.

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic