throw interrupted exception instead of catching and doing nothing
This commit is contained in:
parent
be6972b898
commit
d6eabf0b48
|
@ -47,17 +47,13 @@ public class SimpleExecutorCompletionService_with_take<ResultType> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized public Future<ResultType> take() {
|
synchronized public Future<ResultType> take() throws InterruptedException {
|
||||||
// update list first to check if tasks are already completed
|
// update list first to check if tasks are already completed
|
||||||
this.updateFuturesLists();
|
this.updateFuturesLists();
|
||||||
|
|
||||||
// wait until a task finishes, if there aren't any currently done
|
// wait until a task finishes, if there aren't any currently done
|
||||||
while (this.doneFutures.isEmpty()) {
|
while (this.doneFutures.isEmpty()) {
|
||||||
try {
|
|
||||||
wait();
|
wait();
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// update list again, after being notified, since callable wrapper can't update list
|
// update list again, after being notified, since callable wrapper can't update list
|
||||||
// this SHOULD always result in at least one future being added to the done list
|
// this SHOULD always result in at least one future being added to the done list
|
||||||
|
|
Loading…
Reference in New Issue