Skip to content

Commit 954023a

Browse files
committed
respect new cache_size
1 parent 244ac4e commit 954023a

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

xds/src/main/java/io/grpc/xds/GcpAuthenticationFilter.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,18 +276,17 @@ private void resizeCache(int newSize) {
276276
maxSize = newSize;
277277
return;
278278
}
279-
LinkedHashMap<K, V> newCache = createEvictingMap(newSize);
279+
LinkedHashMap<K, V> newCache = (LinkedHashMap<K, V>) createEvictingMap(newSize);
280280
newCache.putAll(cache);
281281
cache = newCache;
282282
maxSize = newSize;
283283
}
284284

285-
@SuppressWarnings("NonApiType")
286-
private LinkedHashMap<K, V> createEvictingMap(int size) {
285+
private Map<K, V> createEvictingMap(int size) {
287286
return new LinkedHashMap<K, V>(size, 0.75f, true) {
288287
@Override
289288
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
290-
return size() > LruCache.this.maxSize;
289+
return size() > size;
291290
}
292291
};
293292
}

0 commit comments

Comments
 (0)