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
PropertyChangeListenertoSwingWorker, then you can to determine of status fromSwingWorkerhave to implemented
get()in theSwingWorker‘s methoddone(), otherwise isn’t possible to get an exeption(s) from invoked methodsdepend 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