xxrobboxx / opentestbed

Automatically exported from code.google.com/p/opentestbed
0 stars 0 forks source link

JFreeChart not thread safe #28

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I believe the creation of the JFreeChart GUI and all modifications to it should 
go through
SwingUtilities.invokeLater(...)
to make it threadsafe.
Right now the main thread makes these updates.

Original issue reported on code.google.com by guy...@gmail.com on 4 Nov 2010 at 4:49

GoogleCodeExporter commented 8 years ago
All updates should be done in the SwingThread already as a javax.swing.Timer is 
used for the updates.
One could discuss whether building the initial frame should be done on the 
UIThread as well, but as far as I know it is allowed to create a GUI on a 
foreign thread as long as its not made visible.

One could also discuss the upateBankroll method, as read-access on 
currentGamesPlayed + currentSeatPermutation is not synchronized (but they are 
volatile), but I thought noone would care if on the GUI both values are one off 
compared to the graph.

Changes/Read-Access  to the 'stats' variable is synchronized though.

So from my point of view we have no threading problems.

Original comment by bluegasp...@gmail.com on 13 Nov 2010 at 9:34