Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Not A Bug
-
Affects Version/s: 1.4.1
-
Fix Version/s: None
-
Component/s: Converters
-
Labels:None
-
JDK version and platform:Java HotSpot Server VM "1.6.0_07"; Linux
Description
Sharing a StringConverter between multiple threads leads to exceptions (sometimes ArrayIndexOutOfBoundsException, sometimes ConcurrentModificationException). In our scenario, the cache used by the converter is given to the converter's toString() method.
I attach a minimal test case that reproduces the problem on my machine on almost every run.
Thanks for fixing this issue!
This is by design. If you provide a map yourself, you have to ensure that it is synchronized, if you intent to use the converter instance in parallel. If the StringConverter initializes the map itself, it will use a synchronized one to support the most common use case.