When accessing dozer mapper with concurrent thread (Bean Mapper is defined singleton) , I am getting numerous different kind of exceptions starting from Illegal Argument Exception to Class cast Exception.
Dozer version - 5.3.2
Integrated with Spring.
Issue occurs whenever the concurrency in the application increases. This is kind of urgent issue, Please advise whether its a known bug in handling concurrency. Is there an workaround other than making the mapper block synchronized.
There is already a bug for this it would be good if you can add your finding to it.
There are known issues in concurrency area with MapperAware and Configurable custom converters.
One solution is to use synchronization as you mentioned. The other one would be relying on Dozer to instantiate converter by itself on demand, but this means only default constructor is supported and dependencies can be retrieved through static methods only.
In the long term custom converters should come from Factory or BeanContainer interface, which is implemented by Spring adapter.
Thanks dmitry, since its a high volume application , not sure whether i can go with the synchronized block. I couldn't understand the second part on dozer to instantiate the converter by itself on demand.
If you define custom converters in Dozer mappings and do not pass instances using setCustomConverters() they will be instantiated for each mapping.
So just try to remove customConverter part of configuration in Spring and make no argument constructors.
Thanks Dmitry , it did worked much appreciated. BTW we have heavy dependency on custom converters with the spring integration for properties, is there any release in between addressed to fix this .
There are plans to release 5.3.3 version somewhere in October. But I believe it is too big rework to make this fix into minor release.
So expect it to appear in 5.4. The best guess would be end of the year, unless the project will have additional contributors.
I am looking into a quickfix for the MapperAware issue if I get soemthing working properly I will supply a patch.
I can contribute if possible , Please let me know how should i do about it.
Log in to post a comment.