-
Bug
-
Resolution: Not an Issue
-
P3
-
21, 22, 23
-
b12
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
When a SwingWorker is cancelled before the executor has picked it up for execution and calls its run() method, the done() method will never be called.
This is a major behavior change in version 21 compared to prior releases, and is a side effect of the changes in commit dbb5581 that resolvedJDK-8081474.
REGRESSION : Last worked in version 17.0.11
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a swing worker, pass it to the executor and cancel it immediately before the executor calls the run() method of the worker.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
done() is called as in version 20 and earlier.
ACTUAL -
done() is not called.
---------- BEGIN SOURCE ----------
public class Main {
private static class Worker extends SwingWorker {
@Override
protected Object doInBackground() throws Exception {
return null;
}
@Override
protected void done() {
System.out.println("done called");
}
}
public static void main(String... args) {
Worker worker = new Worker();
worker.execute();
worker.cancel(false);
}
}
---------- END SOURCE ----------
FREQUENCY : always
When a SwingWorker is cancelled before the executor has picked it up for execution and calls its run() method, the done() method will never be called.
This is a major behavior change in version 21 compared to prior releases, and is a side effect of the changes in commit dbb5581 that resolved
REGRESSION : Last worked in version 17.0.11
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a swing worker, pass it to the executor and cancel it immediately before the executor calls the run() method of the worker.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
done() is called as in version 20 and earlier.
ACTUAL -
done() is not called.
---------- BEGIN SOURCE ----------
public class Main {
private static class Worker extends SwingWorker {
@Override
protected Object doInBackground() throws Exception {
return null;
}
@Override
protected void done() {
System.out.println("done called");
}
}
public static void main(String... args) {
Worker worker = new Worker();
worker.execute();
worker.cancel(false);
}
}
---------- END SOURCE ----------
FREQUENCY : always