"Thread-21" daemon prio=5 tid=85 WAITING at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:503) at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.waitResult(AbstractThreadSubreportRunner.java:81) Local Variable: net.sf.jasperreports.engine.fill.ThreadExecutorSubreportRunner#2 at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.start(AbstractThreadSubreportRunner.java:53) at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:758) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331) Local Variable: net.sf.jasperreports.engine.fill.JRFillSubreport#3 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:384) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:358) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow(JRVerticalFiller.java:458) Local Variable: net.sf.jasperreports.engine.fill.JRFillBand#3 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:421) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageBreak(JRVerticalFiller.java:1954) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBreak(JRVerticalFiller.java:1981) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:754) Local Variable: net.sf.jasperreports.engine.fill.JRFillBand[]#1 Local Variable: net.sf.jasperreports.engine.fill.JRFillBand#2 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:939) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:152) Local Variable: net.sf.jasperreports.engine.util.LocalJasperReportsContext#1 Local Variable: net.sf.jasperreports.engine.fill.JRVerticalFiller#1 at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:464) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:300) Local Variable: java.io.File#135 Local Variable: net.sf.jasperreports.engine.JasperFillManager#1 Local Variable: net.sf.jasperreports.engine.JasperReport#1 at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:757) at com.pingan.icore.print.asyntask.jasper.AysnJasPdfConvertorThread.fill(AysnJasPdfConvertorThread.java:110) Local Variable: java.lang.String#57815 Local Variable: java.lang.String#55498 Local Variable: java.util.HashMap#1682 Local Variable: java.lang.String#57807 Local Variable: java.lang.String#57809 at com.pingan.icore.print.asyntask.jasper.AysnJasPdfConvertorThread.run(AysnJasPdfConvertorThread.java:223) Local Variable: java.io.File#139 Local Variable: java.io.File#138 Local Variable: java.io.File#137 Local Variable: java.io.File#136 Local Variable: com.pingan.icore.print.asyntask.jasper.AysnJasPdfConvertorThread#1 at java.lang.Thread.run(Thread.java:722)
可以看出新版的jasperreports依然会有该问题。只能通过取消勾选 ‘Print When Detail Overflows’的选项来避免该问题
同时使jasperreport的virtualizer(Virtualizes data to the filesystem. When this object is finalized, it removes the swap files it makes. The virtualized objects have references to this object, so finalization does not occur until this object and the objects using it are only weakly referenced.)
来优化jasperreport的内存使用,减轻症状。
下面给出个使用demo: