mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Use removeIf rather than Iterator-based removal
See gh-34762
This commit is contained in:
parent
5a6e7d1226
commit
0d13e31827
@ -109,13 +109,7 @@ public class CachingOperationInvoker implements OperationInvoker {
|
|||||||
|
|
||||||
private void cleanExpiredCachedResponses(long accessTime) {
|
private void cleanExpiredCachedResponses(long accessTime) {
|
||||||
try {
|
try {
|
||||||
Iterator<Entry<CacheKey, CachedResponse>> iterator = this.cachedResponses.entrySet().iterator();
|
this.cachedResponses.entrySet().removeIf(entry -> entry.getValue().isStale(accessTime, this.timeToLive));
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Entry<CacheKey, CachedResponse> entry = iterator.next();
|
|
||||||
if (entry.getValue().isStale(accessTime, this.timeToLive)) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
}
|
}
|
||||||
|
@ -182,13 +182,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
|
|||||||
for (String type : spec.getTypes()) {
|
for (String type : spec.getTypes()) {
|
||||||
Collection<String> typeMatches = getBeanNamesForType(classLoader, considerHierarchy, beanFactory, type,
|
Collection<String> typeMatches = getBeanNamesForType(classLoader, considerHierarchy, beanFactory, type,
|
||||||
parameterizedContainers);
|
parameterizedContainers);
|
||||||
Iterator<String> iterator = typeMatches.iterator();
|
typeMatches.removeIf(match -> beansIgnoredByType.contains(match) || ScopedProxyUtils.isScopedTarget(match));
|
||||||
while (iterator.hasNext()) {
|
|
||||||
String match = iterator.next();
|
|
||||||
if (beansIgnoredByType.contains(match) || ScopedProxyUtils.isScopedTarget(match)) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (typeMatches.isEmpty()) {
|
if (typeMatches.isEmpty()) {
|
||||||
result.recordUnmatchedType(type);
|
result.recordUnmatchedType(type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user