I need to maintain a hashmap which should be public to all the threads executing.
For example the hashmap updated by one particular thread should be available to the other threads also and vice versa. Please suggest me with the implementation in Java.
The main program contains the hashmap. From this main thread i will be trigerring many threads. Each thread should access the same hashmap available in the main program.
Thanks in advance.
look here for all thread safe data structures…
http://download.oracle.com/javase/6/docs/api/java/util/concurrent/package-summary.html
i guess you need a concurrent hash map. If you can change your map to a list, you can use CopyOnWriteArrayList which allows a highly efficient thead safe way to read write to a list.