Concurrent Collection Classes
Concurrent Collection Classes
A collection of Application Programming Interfaces that deal particularly with concurrent operations. These classes are alternative to the Java Collection Framework and provides similar functionality although with additional support towards Concurrency.
The ultimate goal of this collection is to allow many threads access to resources in a synchronised manor.
Concurrent Collections in Java
According to Oracle.com and as quoted below:
"The java.util.concurrent package includes a number of additions to the Java Collections Framework. These are most easily categorized by the collection interfaces provided:
BlockingQueuedefines a first-in-first-out data structure that blocks or times out when you attempt to add to a full queue, or retrieve from an empty queue.ConcurrentMapis a subinterface ofjava.util.Mapthat defines useful atomic operations. These operations remove or replace a key-value pair only if the key is present, or add a key-value pair only if the key is absent. Making these operations atomic helps avoid synchronization. The standard general-purpose implementation ofConcurrentMapisConcurrentHashMap, which is a concurrent analog ofHashMap.ConcurrentNavigableMapis a subinterface ofConcurrentMapthat supports approximate matches. The standard general-purpose implementation ofConcurrentNavigableMapisConcurrentSkipListMap, which is a concurrent analog ofTreeMap.
All of these collections help avoid Memory Consistency Errors by defining a happens-before relationship between an operation that adds an object to the collection with subsequent operations that access or remove that object."
Comments
Post a Comment