Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context.dumpMap is throwing ConcurrentModificationException #212

Closed
ar opened this issue Apr 11, 2019 · 2 comments
Closed

Context.dumpMap is throwing ConcurrentModificationException #212

ar opened this issue Apr 11, 2019 · 2 comments

Comments

@ar
Copy link
Member

ar commented Apr 11, 2019

java.util.ConcurrentModificationException
	at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:711)
	at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:744)
	at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:742)
	at org.jpos.transaction.Context.dumpMap(Context.java:250)
	at org.jpos.transaction.Context.dump(Context.java:147)
	at org.jpos.util.LogEvent.dump(LogEvent.java:139)
	at org.jpos.util.LogEvent.toString(LogEvent.java:219)
	at org.jpos.util.LogEvent.toString(LogEvent.java:224)
	at org.jpos.util.FrozenLogEvent.<init>(FrozenLogEvent.java:28)
	at org.jpos.transaction.TransactionManager.run(TransactionManager.java:397)
	at java.lang.Thread.run(Thread.java:745)

jPOS-Users discussion

@ar ar closed this as completed in 42f58b1 Apr 16, 2019
@chhil
Copy link
Contributor

chhil commented Apr 16, 2019

If the map is a Collections.synchronizedMap (new LinkedHashMap<>()); do we still need to use synchronized while iterating it?

@ar
Copy link
Member Author

ar commented Apr 16, 2019

Yes. From Collections.synchronizedMap javadoc:

It is imperative that the user manually synchronize on the returned
map when iterating over any of its collection views:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants