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
phantom-dsl
github-for-windows
rsa
static
interface
camera
knitr
missing-data
retrofit2
barcode
pattern-matching
mel
siddhi
altera
modbus-tcp
dreamweaver
googlebot
babel
jboss6.x
xcode-ui-testing
appirater
intersystems-cache
soot
nsurl
google-cast
autodesk-designautomation
panoramas
scatter3d
code-snippets
dsx-desktop
hreflang
twos-complement
slacktextviewcontroller
yowsup
servicestack-text
sql-server-ce
connection-pool
projects-and-solutions
mongoose-schema
levenshtein-distance
postgresql-8.4
claims
openal
lampp
dtsearch
remedy
mouseleave
pybrain
branch-prediction
lrs
burrows-wheeler-transform
jboss-tools
wso2developerstudio
i386
scaffolding
simevents
kango-framework
hadoop-partitioning
fuzzywuzzy
libvlc
sapi
morton-number
video-player
eoferror
jdk1.7
dulwich
cwrsync
user-permissions
dot.js
umlgraph
public-html
adehabitathr
cosine-similarity
beatsmusic
metatrader5
universal-image-loader
spring-remoting
xmltodict
notorm
light
ebay-lms
printdialog
observium
poker
mantle
resource-management
joomla3.1
curb
fragmenttransaction
uimanageddocument
azman
usertype
gobject-introspection
entitydatasource
multiplatform
dataform
msr
delimited-text
non-clustered-index
eclipse-marketplace
skype4java
sifr3
sqlobject
ifilter

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