Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Robert Richardson   on Sep 18 In Java Category.

  
Question Answered By: Dustin Dean   on Sep 18

I think You should Use ConcurrentHashMap , In your case I think ConcurrentHashMap is a good solution  ...

A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updates. This class obeys the same functional specification as Hashtable, and includes versions of methods corresponding to each method of Hashtable. However, even though all operations are thread-safe, retrieval operations do not entail locking, and there is not any support for locking the entire table in a way that prevents all access. This class is fully interoperable with Hashtable in programs that rely on its thread  safety but not on its synchronization  details.

Retrieval operations (including get) generally do not block, so may overlap with update operations (including put and remove). Retrievals reflect the results of the most recently completed update operations holding upon their onset. For aggregate operations such as putAll and clear, concurrent retrievals may reflect insertion or removal of only some entries. Similarly, Iterators and Enumerations return elements reflecting the state of the hash table at some point at or since the creation of the iterator/enumeration. They do not throw ConcurrentModificationException. However, iterators are designed to be used by only one thread at a time.


java.sun.com/.../ConcurrentHashMap.html

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on A question on Synchronization Or get search suggestion and latest updates.


Tagged: