}
try
{
final long startTime = System.currentTimeMillis();
fireProcessingStarted(new ReportProgressEvent(this));
if (isPaginated() == false)
{
// Processes the whole report ..
prepareReportProcessing();
}
PerformanceLoggingStopWatch sw =
getPerformanceMonitorContext().createStopWatch(PerformanceTags.REPORT_GENERATE);
try
{
sw.start();
final long paginateTime = System.currentTimeMillis();
if (AbstractReportProcessor.logger.isDebugEnabled())
{
AbstractReportProcessor.logger.debug(new MemoryUsageMessage
(System.identityHashCode(Thread.currentThread()) +
": Report processing time: Pagination time: " + ((paginateTime - startTime) / 1000.0)));
}
if (getLogicalPageCount() == 0)
{
throw new EmptyReportException("Report did not generate any content.");
}
// Start from scratch ...
PageState state = getLogicalPageState(0);
while (state != null)
{
state = processPage(state, true);
}
final long endTime = System.currentTimeMillis();
if (AbstractReportProcessor.logger.isDebugEnabled())
{
AbstractReportProcessor.logger.debug(new MemoryUsageMessage
(System.identityHashCode(Thread.currentThread()) +
": Report processing time: " + ((endTime - startTime) / 1000.0)));
}
}
finally
{
sw.close();
}
}
catch (EmptyReportException re)
{
throw re;
}
catch (ReportProcessingException re)
{
AbstractReportProcessor.logger.error(System.identityHashCode(
Thread.currentThread()) + ": Report processing failed.", re);
throw re;
}
catch (Exception e)
{
AbstractReportProcessor.logger.error(System.identityHashCode(
Thread.currentThread()) + ": Report processing failed.", e);
throw new ReportProcessingException("Failed to process the report", e);
}
fireProcessingFinished(new ReportProgressEvent(this, getPhysicalPageCount()));
if (AbstractReportProcessor.logger.isDebugEnabled())
{
AbstractReportProcessor.logger.debug(System.identityHashCode(
Thread.currentThread()) + ": Report processing finished.");
}