thread safe map for java
Solution 1:
java.util.concurrent.ConcurrentHashMap
Solution 2:
The ConcurrentHashMap
class from the java.util.concurrent
package is a thread-safe implementation of Map that offers far better concurrency than synchronizedMap
(and far superior scalability over Hashtable
). See http://www.ibm.com/developerworks/java/library/j-jtp07233.html.
Solution 3:
Use ConcurrentHashMap