[ 1801842 ] DB connection fix & improvements for concurrent threads.

This commit is contained in:
Heng Sin Low 2007-10-05 03:24:06 +00:00
parent 92e241978d
commit ea6cce5ebb
1 changed files with 9 additions and 1 deletions

View File

@ -493,9 +493,11 @@ public class ReportStarter implements ProcessCall, ClientProcess {
} }
} }
Connection conn = null;
try { try {
//JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, DB.getConnectionRW()); //JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, DB.getConnectionRW());
JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, getConnection()); conn = getConnection();
JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, conn);
if (reportData.isDirectPrint()) { if (reportData.isDirectPrint()) {
log.info( "ReportStarter.startProcess print report -" + jasperPrint.getName()); log.info( "ReportStarter.startProcess print report -" + jasperPrint.getName());
JasperPrintManager.printReport( jasperPrint, false); JasperPrintManager.printReport( jasperPrint, false);
@ -509,6 +511,12 @@ public class ReportStarter implements ProcessCall, ClientProcess {
} }
} catch (JRException e) { } catch (JRException e) {
log.severe("ReportStarter.startProcess: Can not run report - "+ e.getMessage()); log.severe("ReportStarter.startProcess: Can not run report - "+ e.getMessage());
} finally {
if (conn != null)
try {
conn.close();
} catch (SQLException e) {
}
} }
} }