Java concurrent data structures
Java has a number of mutable data structures that are meant for concurrency and thread-safety, which implies that multiple callers can safely access these data structures at the same time, without blocking each other. When we need only the highly concurrent access without the state management, these data structures may be a very good fit. Several of these employ lock free algorithms. We discussed about the Java atomic state classes in the Atomic updates and state section, so we will not repeat them here. Rather, we will only discuss the concurrent queues and other collections.
All of these data structures live in the java.util.concurrent
package. These concurrent data structures are tailored to leverage the JSR 133 "Java Memory Model and Thread Specification Revision" (http://gee.cs.oswego.edu/dl/jmm/cookbook.html) implementation that first appeared in Java 5.
Concurrent maps
Java has a mutable concurrent hash map—java.util.concurrent.ConcurrentHashMap
(CHM...