The first thread is of JMS subscriber that listens to a topic. As soon as it gets a message it adds/updates/deletes entries in a hashmap. Another thread runs after every 2 mins using TimerClass and reads the contents of the same hashmap and stores it in a file and clears the hashmap. Please suggest what kind of hashmap- concurrent or synchronized should be used? is there any other way to achieve this ?