Redesing of configuration and startup aka Hibernate



JasperReports heavily use ThreadLocal and static HashMaps which may cause memory leaks in the servlet containers. I think the JasperReports configuration and startup should be redesigned and the good examples is a Hibernate project. It uses:

Configuration (immutable, thread safe) -> SessionFactory (thread safe) -> Session (thread unsafe).

So the SessionFactory is created just one per application (stored it the static variable, servlet context or bound to the JNDI.

The JasperReponts could may use

Configuration (immutable, thread safe) -> ReportFactory (thread safe) -> new JasperReport (thread unsafe).

All the resources, which are now cached in the  ThreadLocal or static HashMaps would be cached in the Configuration or ReportFactory.

Also, some utils to bind the ReportFactory to the JNDI would be nice. The JNDI may simplify usage of JasperReports in JEE environment.





xmedeko's picture
Joined: Sep 2 2010 - 2:00am
Last seen: 8 years 10 months ago

0 Answers:

No answers yet