Hi,
I've got a thread that generates data, sending it to a class that interprets it. The user can select to visualise the data as its being generated using JFreeChart.
If I run thread to conclusion, without opening the chart, it works fine.
If I run the thread with a long sleep time (>15) it works fine when I display the progress on JFreechart.
But, if the thread is set to <15, I get the following error:
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at com.jrefinery.chart.CombinedXYPlot.getHorizontalDataRange(Unknown Source)
at com.jrefinery.chart.HorizontalNumberAxis.autoAdjustRange(Unknown Source)
at com.jrefinery.chart.HorizontalNumberAxis.configure(Unknown Source)
at com.jrefinery.chart.XYPlot.datasetChanged(Unknown Source)
at com.jrefinery.chart.XYPlot.datasetChanged(Unknown Source)
at com.jrefinery.data.AbstractDataset.notifyListeners(Unknown Source)
at com.jrefinery.data.AbstractDataset.fireDatasetChanged(Unknown Source)
at com.jrefinery.data.AbstractSeriesDataset.seriesChanged(Unknown Source)
at com.jrefinery.data.Series.notifyListeners(Unknown Source)
at com.jrefinery.data.Series.fireSeriesChanged(Unknown Source)
at com.jrefinery.data.XYSeries.add(XYSeries.java:141)
at com.jrefinery.data.XYSeries.add(XYSeries.java:209)
at com.jrefinery.data.XYSeries.add(XYSeries.java:168)
at omcd.ConvergenceCheck.getConvergence(ConvergenceCheck.java:150)
at omcd.SimulationControl.run(SimulationControl.java:103)
at java.lang.Thread.run(Unknown Source)
Is this a problem with my code, or this a know thread problem - I get the feeling that displaying the chart messes up the thread execution, and I get the concurrent error (which eplains why a long sleep prevents it). Is there any way around this?
Kind regards
ConcurrentModificationException Thread Question
Re: ConcurrentModificationException Thread Question
I started doing some work to synchronise dataset updates and chart redraws. But it isn't complete yet, so there is currently no thread synchronisation in JFreeChart. Hopefully there will be something in 0.9.5.
Regards,
DG
Regards,
DG