Concurrent modification exception inside fully synchronized code


I am sharing an instance of a Vector in two places, one is populating the vector and another one is iterating it. two codes are synchronized. Very frequently I got in to a problem saying ConcurrentModificationException while iterating the code. Ofcourse, while iterating we may not update the collection. But will it lead to this kind of exception while the code is inside a synchronized. On cloning the collection, I cud come out of the problem. But this may not be a solution!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s