The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

tdeleeuw (9) [Avatar] Offline
#1
Hi,

Wouldn't it be better to replace/provide a new methods to get a ConcurrentHashMap, instead of a collections.SynchronizedMap as it is a lot more efficient?

If the "original" map is a TreeMap, of course, there is no equivalent in Concurrent, so fallback to Synchronized seems a good compromise.

Thanks

Thierry
paulk_asert (33) [Avatar] Offline
#2
Re: Replace usage of Collections.SynchronizedMap/List?
The current methods have existed for several versions of Groovy and will likely remain. It might be quite useful to also support ConcurrentHashMap and related classes. This will likely not be possible in time for this edition of the book but feel free to raise a feature request in Groovy's Codehaus Jira if you want your request to be tracked. And BTW, I agree with you that a ConcurrentHashMap is often a lot more efficient than the SynchronizedMap class for many scenarios - though they are not exact equivalents. Thanks for your thoughtful comment.
tdeleeuw (9) [Avatar] Offline
#3
Re: Replace usage of Collections.SynchronizedMap/List?
Created jira GROOVY-6228 (https://jira.codehaus.org/browse/GROOVY-622smilie as proposed

For the name I propose "asConcurrent" to be in line with "asSynchronized"