Concurrent access to dozer bean mapper issue

Help
Maruthi S
2011-09-22
2013-05-02
  • Maruthi S

    Maruthi S - 2011-09-22

    Hi

    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.

    Regards
    Maruthi S

     
  • dmitry (lv)

    dmitry (lv) - 2011-09-22

    Hi,

    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.

    Dmitry

     
  • Maruthi S

    Maruthi S - 2011-09-22

    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.

    Regards
    Maruthi S

     
  • dmitry (lv)

    dmitry (lv) - 2011-09-22

    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.

     
  • Maruthi S

    Maruthi S - 2011-09-22

    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 .

    Please advise.

     
  • dmitry (lv)

    dmitry (lv) - 2011-09-22

    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.

     
  • Fuzail Sarang

    Fuzail Sarang - 2011-09-22

    I am looking into a quickfix for the MapperAware issue if I get soemthing working properly I will supply a patch.

     
  • Maruthi S

    Maruthi S - 2011-09-22

    Hi Dmitry

    I can contribute if possible , Please let me know how should i do about it.

    Regards
    Maruthi S

     

Log in to post a comment.