I have a swing worker which configures a serial port connection. This process takes an indeterminable time to complete, sometimes 1 minute sometimes a lot more.
My problem arises when users click a button that needs configuration data whilst the worker thread is still configuring.
I would like to know how to execute a user's request only if the worker thread has completed. Else if worker thread in still alive, I want execution to wait until worker thread has finished.
add PropertyChangeListener
to SwingWorker
, then you can to determine of status from SwingWorker
have to implemented get()
in the SwingWorker
's method done()
, otherwise isn't possible to get an exeption(s) from invoked methods
depend of code but I doubt that is possible to change setting, untill current thread ended, better could be to SwingWorker#cancel()
and then to restart this instance