Fri Jan 10 20:22:46 HKT 2020
is thread safe, serialize sync List is NOT thread safe for sure. The story is, if you only synchronized the collection, and if we try to get the iterator in concurrent access environment, it will throws currencymodificationexception .
For collection is small, may be making defensive copy http://www.javapractices.com/Topic15.cjp is good. Otherwise, in java5, there is concurrency collection.
Map operation, include use of FutureTask and putIfAbsent() method from ConcurrentMap. - http://www.javaspecialists.co.za/archive/newsletter.do?issue=125
Other then lterate through the elements, adding and removing elements can also be problem, this article document a few good cases about that - http://rayfd.wordpress.com[..]en-a-synchronized-class-isnt-threadsafe/
Samples of using Queue.drainTo() - http://binkley.blogspot.com[..]rforming-fixed-amounts-of-work-with.html
Overview of blockingqueue - http://tutorials.jenkov.com[..]/java-util-concurrent/blockingqueue.html
Simple benchmark - http://java-persistence-performance.blogspot.com[..]jvm-performance-part-iii-concurrent.html
Multi-thread behaviour - http://vanillajava.blogspot.com[..]hread-safety-issues-with-vector-and.html
java.util.concurrent.ConcurrentHashMap VS openhft.collections.SharedHashMap - http://openhft.blogspot.co.uk[..]autilconcurrentconcurrenthashmap-vs.html
Why are there so many concurrent queues implementations in Java? - https://vmlens.com/articles/cp/why_so_many_queues/
(google search) (amazon search)