This commit is contained in:
Luca Conte 2025-05-22 11:35:52 +02:00
parent 97ac54fe85
commit dab09d6657
1 changed files with 4 additions and 4 deletions

View File

@ -64,16 +64,16 @@ public class SimpleExecutorCompletionService_with_take<ResultType> {
synchronized private void updateFuturesLists() {
for (int i = 0; i < this.pendingFutures.size(); i++) {
Future<ResultType> f = this.pendingFutures.get(i);
// for (int i = 0; i < this.pendingFutures.size(); i++) {
for (Future<ResultType> f : this.pendingFutures) {
// Future<ResultType> f = this.pendingFutures.get(i);
// for (Future<ResultType> f : this.pendingFutures) {
// causes concurrent access exception - why?
if (f.isDone()) {
this.pendingFutures.remove(f);
this.doneFutures.add(f);
notify();
//notify();
}
}