Concurrency Issue With POJO oda datasource [message #1240008] |
Wed, 05 February 2014 14:14 |
John Hale Messages: 1 Registered: February 2014 |
Junior Member |
|
|
Hi,
We are using BIRT to generate part of an account statement. Everything works fine as long as I create them one at a time. If I spread it out across multiple threads I get an NPE at Line 84 of org.eclipse.birt.data.oda.pojo.querymodel.MethodSource.
My code is as follows. I don't see anything glaring that I have done wrong based on my previous research. Sharing runnables and engine. Creating new task objects.
Using BIRT runtime 4.3.0
byte[] retVal = null;
String reportName = "SomeReport";
String format = "pdf";
try {
IReportRunnable runnable = reportCache.getRunnable(REQUEST_RUNNABLE_ATTR);
if (runnable == null) {
runnable = initializeRunnable(reportCache, reportName);
}
IRunAndRenderTask runAndRenderTask = getBirtEngine().getReportEngine().createRunAndRenderTask(runnable);
IRenderOption options = new RenderOption();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PDFRenderOption pdfOptions = new PDFRenderOption( options );
pdfOptions.setOutputFormat(format);
pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, IPDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES);
pdfOptions.setOutputStream(baos);
runAndRenderTask.setRenderOption(pdfOptions);
ArrayList<AccountStatement> statementList = new ArrayList<AccountStatement>();
statementList.add(accountStatement);
runAndRenderTask.getAppContext().put("APP_CONTEXT_KEY_ACCOUNTSTATEMENTDATASET", statementList);
runAndRenderTask.getAppContext().put("APP_CONTEXT_KEY_ACCOUNTCHARGELINEITEMSOURCE", createChargeLineItems(context, accountStatement));
runAndRenderTask.getAppContext().put("APP_CONTEXT_KEY_USEDLOCATIONS", accountStatement.getUsedLocations());
runAndRenderTask.run();
runAndRenderTask.close();
retVal = baos.toByteArray();
baos.close();
} catch (Exception ex) {
ExceptionUtil.throwRuntimeException("Could not create BIRT Report", ex);
}
return retVal;
Best Regards,
John
|
|
|
|
Powered by
FUDForum. Page generated in 0.02597 seconds