JavaFX UI Freezing Issue JavaFX UI Freezing Issue multithreading multithreading

JavaFX UI Freezing Issue


Your 'QueueData' class should have methods to set double property of existing progress, it seems you are creating new SimpleDoubleProperty each and every time on setting progress status in setprogressBar(Double sType) method.

Update this as -

 public void setprogressBar(Double sType) {        this.progressBar.set(sType);    }

Just create object of progressBar once at start then update existing one.


As I understand your code you are flipping the visibility to trigger the updateItem method on the table cell? This means that any number of threads could be trying to change the visibility every second and repaint endlessly.

I know you are already quite far with your implementation but the JavaFX service class already implements a progress feature which you can update which would be much simpler than how you are doing it now.

It would be much simpler and efficient to have a progress double property which you update from your thread and bind this to the ProgressBar.progressProperty() so everything would automatically update. This is how the Service class works but it is easy to implement yourself.

Also make sure you are disposing your threads, this is easy to check. Debug in eclipse and in the debug perspective it will show you the list of threads, make sure it doesn't grow endlessly.

For scheduling a Runnable checkout the ScheduledExecutor class, you can easily create it by using Executors.newScheduledThreadPool(numOfThreads).