[Engine-devel] engine-core redundant instantiation of mappers

Yair Zaslavsky yzaslavs at redhat.com
Mon Jan 23 15:38:20 UTC 2012


Hi all,
I am refactoring now DiskImageDAODbFacadeImpl.
As part of my work, I'm also defining there a Spring-JDBC mapper ,
similar to other ParameterizedRowMapper based mappers we have in code
(i.e DbUserDAODbFacadeImpl has one)
Looks like in our DAO getXXXX methods we instantiate these mapper
objects (each method creates a new mapper object).
Can anyone see a reason , in case a mapper object is stateless (and from
what I see, they are) - why not to have a single instantiation per
mapper type (i.e - Have a MapperUtils class, with static methods like
MapperUtils.getDiskImageMapper() ?
IMHO this can save us some unnecessary instanatiations and improve
performance

Yair



More information about the Engine-devel mailing list