Hi,
I have converted my HashMap to Synchronized Map and when I try to put some value into Map through Multi
Thread its not working correctly. Below are sample code which I'm using
OUTPUT:
Thread-1 : java-Thread-1Thread-2
Thread-2 : java-Thread-1Thread-2
Thread-0 : java-Thread-1Thread-2
Thread-3 : java-Thread-1Thread-2Thread-3
Thread-4 : java-Thread-1Thread-2Thread-3Thread-4
VALUE ::: java-Thread-1Thread-2Thread-3Thread-4
Where as program needs to give out by upending all thread names from 0-4. But in above output Thread-0 is missing. When I make Map to Synchronized then it should be thread safe and all thread names must to added in Map value.
So any one let me know what is the issue in my code ?
Thanks
Anand