swingworker


is SwingWorker.done() guaranteed to execute after the worker's last invocation of SwingWorker.process()?


Here's what the documentation for SwingWorker says:
- doInBackground() executes in a worker thread
- process() executes asynchronously on the Event Dispatch thread (AWT EDT). It's execution is unpredictable with respect to calls to publish() in the worker thread
- done() executes in the AWT EDT after doInBackground() has completed
I cannot see anything that says the last invocation of process() is always executed before done() (they both run on the same thread).
I have multiple calls to publish() from doInBackground(); the published objects are picked up in process() and used to update a GUI with progress reports. A literal interpretation of the documentation could imply that it's possible for done() to be scheduled on the EDT before the very last execution of process(), because done() is guaranteed to execute after the worker thread but process() is documented as being unpredictable.
All my tests show that done() runs after the last publish() (which makes sense, and it's what I want), but has anyone seen documentation or dug into the code to verify if SwingWorker is designed to guarantee that behaviour?
the answer is no. See DSquare's answer linked to below.
publish() doesn't directly schedule process, it sets a timer which
will fire the scheduling of a process() block in the EDT after DELAY.

Related Links

ProgressBar and ScheduledExecutorService
Can I modify states of an object in a swing worker thread which has existed before the SwingWorker is instantiated?
Interrupting more SwingWorkers at once
Is it beneficial to use SwingWorker when it has to block the UI?
JProgress Bar not updating
Cannot call a method in swing worker
is SwingWorker.done() guaranteed to execute after the worker's last invocation of SwingWorker.process()?

Categories

HOME
microsoftgraph
string
pagination
pascal
vscode-extensions
database-normalization
cublas
web-hosting
settings
vsm
missing-data
32bit-64bit
commonjs
onedrive-api
symbol
do-while
parameter-passing
capistrano3
internationalization
pyramid
nim
question2answer
tosca
google-api-client
moses
android-sharedpreferences
motion-detection
licensing
amazon-quicksight
mql
uitapgesturerecognizer
finagle
constexpr
complex-numbers
catch-unit-test
erb
clickjacking
jett
hard-drive
activexobject
reactjs.net
servicestack-text
raft
docfx
watchman
graphhopper
jvmti
comparison-operators
ogc
outputcache
android-checkbox
file-sharing
flask-login
opencmis
x++
dynamic-linq
dbcontext
corruption
modelsim
css-transforms
reshape
change-tracking
envi
adafruit
clipboard.js
jtwig
qiime
angular-ui-typeahead
bizagi
nio2
crouton-os
libvlc
rate-limiting
xvim
include-guards
entity-framework-4.3
rrule
delayed-execution
angular-gettext
filesplitting
browserify-shim
device-tree
psr-4
nsmenu
trdion2011
paste
gae-quotas
git-repo
visual-studio-express
solace-mq
embedded-fonts
breakout
jeromq
ice-cube
nebula
cardreader
qtconcurrent
objectquery
pylucene
http-daemon
presentation-layer
undefined-index
uideviceorientation
vs-android
interop-domino
int64
firefox-3
technical-debt

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App