java.util.ConcurrentModificationException




Asked on April 21, 2013
Hi I am running a multi-threading program and getting below error.

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$KeyIterator.next(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Any suggestion.



Replied on April 21, 2013
It seems that more than one thread are trying to update  a variable.



Replied on April 21, 2013
As error says that yo have used  hashmap in multi threading environment, you need to use
ConcurrentHashMap


Write Answer










©2024 concretepage.com | Privacy Policy | Contact Us