Skip to content

Commit bd4ac62

Browse files
committed
Job.join() returns early on cancel, call it another time #195
See eclipse-platform/eclipse.platform#2210 (comment)
1 parent 247dd6c commit bd4ac62

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

runtime/tests/org.eclipse.rcptt.tesla.swt.test/src/org/eclipse/rcptt/tesla/swt/test/UIJobCollectorTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,10 @@ public void done(IJobChangeEvent event) {
358358
private boolean shutdown(Job job, int timeoutInSeconds) throws InterruptedException {
359359
long stop = System.currentTimeMillis() + timeoutInSeconds * 1000;
360360
job.cancel();
361-
while (job.getState() != Job.NONE && System.currentTimeMillis() < stop) {
362-
job.cancel();
363-
job.join(1, null);
364-
}
365-
return job.getState() == Job.NONE;
361+
// Job should always be joined twice to skip cancellation event
362+
// https://github.com/eclipse-platform/eclipse.platform/issues/2210#issuecomment-3448780992
363+
job.join(stop - currentTimeMillis(), null);
364+
return job.join(stop - currentTimeMillis(), null);
366365
}
367366

368367

0 commit comments

Comments
 (0)