Closed
Description
In the current 1.33 implementation the Swing event dispatcher thread is blocked during loading the GCModel. It means that you cannot select anything in the menu, you cannot even quit the application.
I've created a fix in https://github.com/hbswn/GCViewer
It's not production ready, but for developers it's nice to play with.
I added:
- GCModelLoader extends SwingWorker<GCModel, Object>: loads GCModel and sends progress update events
- MonitoredBufferedInputStream: a simple (but not complete) way to monitor progress
- ShutdownHandler: make sure the threads are interrupted, when the application is stopped. (but maybe ExecutorService.shutdown* methods do a better job)
- A parser Logger per URL: otherwise concurrent logging causes some weird behaviour. (info for other files being logged in the error window)
Some issues:
- The progress bar does not look very well but it works
- The progress code only uses the input file position. It should monitor the entire loading process including parsing
- DataReaderFacade is now a singleton. I needed a single "DataReader" thread group and ThreadFactory. Maybe a better solution exists.
- I would prefer to create GCModel before the DataReader is started. Then we can add some properties to monitor the loading process (e.g. file size, date and the current position). GCModel can be passed to the reader and returned, when it's done. Also the parser logger can be created in GCModel and with GCModel's hashCode in its name.
- If loading a file/URL failed, then the item is not removed from the Window list
- GCModelLoader should be canceled if ChartPanelView is closed
Let me know, what you think.
(maybe I should create a Google+ account)