:)  Most of the places we use ConcurrentHashMap it's really only for  
performance.  I.e. if we end up generating the value for a key twice,  
and inserting it twice, that's ok because we'll generate the same  
answer every time.

An interesting read though.

-t

On Jan 21, 2008, at 12:12 PM, Jasper Fontaine wrote:

> Would this article be relevant here?
>
> http://dmy999.com/article/34/correct-use-of-concurrenthashmap
>
> -j
>
> [EMAIL PROTECTED] wrote:
>> Revision: 789
>>          http://stripes.svn.sourceforge.net/stripes/?rev=789&view=rev
>> Author:   bengunter
>> Date:     2008-01-21 09:00:29 -0800 (Mon, 21 Jan 2008)
>>
>> Log Message:
>> -----------
>> Use ConcurrentHashMap for the validation info cache for obvious  
>> reasons
>>
>> Modified Paths:
>> --------------
>>    trunk/stripes/src/net/sourceforge/stripes/validation/ 
>> DefaultValidationMetadataProvider.java
>>
>> Modified: trunk/stripes/src/net/sourceforge/stripes/validation/ 
>> DefaultValidationMetadataProvider.java
>> ===================================================================
>> --- trunk/stripes/src/net/sourceforge/stripes/validation/ 
>> DefaultValidationMetadataProvider.java       2008-01-21 16:25:38 UTC (rev  
>> 788)
>> +++ trunk/stripes/src/net/sourceforge/stripes/validation/ 
>> DefaultValidationMetadataProvider.java       2008-01-21 17:00:29 UTC (rev  
>> 789)
>> @@ -22,6 +22,7 @@
>> import java.util.Collections;
>> import java.util.HashMap;
>> import java.util.Map;
>> +import java.util.concurrent.ConcurrentHashMap;
>>
>> import net.sourceforge.stripes.config.Configuration;
>> import net.sourceforge.stripes.exception.StripesRuntimeException;
>> @@ -42,7 +43,7 @@
>>     private Configuration configuration;
>>
>>     /** Map class -> field -> validation meta data */
>> -    private final Map<Class<?>, Map<String, ValidationMetadata>>  
>> cache = new HashMap<Class<?>, Map<String, ValidationMetadata>>();
>> +    private final Map<Class<?>, Map<String, ValidationMetadata>>  
>> cache = new ConcurrentHashMap<Class<?>, Map<String,  
>> ValidationMetadata>>();
>>
>>     /** Currently does nothing except store a reference to [EMAIL PROTECTED] 
>>  
>> configuration}. */
>>     public void init(Configuration configuration) throws Exception {
>>
>>
>> This was sent by the SourceForge.net collaborative development  
>> platform, the world's largest Open Source development site.
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Stripes-development mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-development
>>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Stripes-development mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-development


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to