Skip to content
Permalink
Browse files
8273894: ConcurrentModificationException raised every time ReferralsC…
…ache drops referral

Backport-of: 2166ed136917bb68f8155a25e4f4a6c5c7115566
  • Loading branch information
shipilev committed Oct 4, 2021
1 parent e6675c7 commit 609c919ffcdc3cb2dfb0df592979ddfd1fc099e6
Showing 1 changed file with 5 additions and 3 deletions.
@@ -28,6 +28,7 @@
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -174,10 +175,11 @@ private static void pruneExpired(ReferralCacheKey k) {
Date now = new Date();
Map<String, ReferralCacheEntry> entries = referralsMap.get(k);
if (entries != null) {
for (Entry<String, ReferralCacheEntry> mapEntry :
entries.entrySet()) {
Iterator<Entry<String, ReferralCacheEntry>> it = entries.entrySet().iterator();
while (it.hasNext()) {
Entry<String, ReferralCacheEntry> mapEntry = it.next();
if (mapEntry.getValue().getCreds().getEndTime().before(now)) {
entries.remove(mapEntry.getKey());
it.remove();
}
}
}

1 comment on commit 609c919

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 609c919 Oct 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.