I am getting the following periodically when generating charts. I am using JDBC datasets and various charts (Scatter, Line, Time series, etc).
What could cause this?
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:440)
at java.util.AbstractList$Itr.next(AbstractList.java:417)
at com.jrefinery.chart.plot.XYPlot.draw(Unknown Source)
at com.jrefinery.chart.JFreeChart.draw(Unknown Source)
at com.jrefinery.chart.JFreeChart.createBufferedImage(Unknown Source)
at com.jrefinery.chart.ChartUtilities.writeChartAsPNG(Unknown Source)
at com.jrefinery.chart.ChartUtilities.saveChartAsPNG(Unknown Source)
at com.jrefinery.chart.ChartUtilities.saveChartAsPNG(Unknown Source)
at ChartCreator.main(ChartCreator.java:150)
The line of code for the ChartCreator is:
150: ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
Any ideas would be greatly helpful!
Thanks,
Dustin
dbreese@qwest.com
Getting random exception on saveAsJpeg
Re: Getting random exception on saveAsJpeg
Is it possible that you are updating the dataset at the same time as the chart is being drawn? At present, there is no thread synchronisation between the datasets and the chart...it is something that is near the top of the list for fixing...
Regards,
Dave Gilbert
Regards,
Dave Gilbert
Re: Getting random exception on saveAsJpeg
David,
Thanks for the reply.
That may be the case. Since it is an applet and I am saving the chart in the main method after the window has been rendered, there are then 2 threads, right? One for my code and one for the rendering/management of the window. However, none of my code modifies the dataset after the window is rendered -- it just uses a JDBCXXXDataset.
The "workaround" I found right after posting the above message was to put a Thread.sleep(2000) before it saves to a PNG/JPEG file. I bet the "real" fix would be to move the save logic into the same method where I render the window?
-Dustin
Thanks for the reply.
That may be the case. Since it is an applet and I am saving the chart in the main method after the window has been rendered, there are then 2 threads, right? One for my code and one for the rendering/management of the window. However, none of my code modifies the dataset after the window is rendered -- it just uses a JDBCXXXDataset.
The "workaround" I found right after posting the above message was to put a Thread.sleep(2000) before it saves to a PNG/JPEG file. I bet the "real" fix would be to move the save logic into the same method where I render the window?
-Dustin