private static class JDBCStatementCache.BoundedLinkedHashMap extends java.util.LinkedHashMap<StatementKey,java.sql.PreparedStatement>
LinkedHashMap
with an upper bound on the number of entries.
If the maximum size is exceeded, the oldest entry is automatically removed after the new entry has been inserted.
Modifier and Type | Field and Description |
---|---|
private int |
maxSize
Maximum number of entries.
|
Constructor and Description |
---|
BoundedLinkedHashMap(int maxCapacity)
Creates a bounded
LinkedHashMap with the specified maximum
size. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
removeEldestEntry(java.util.Map.Entry<StatementKey,java.sql.PreparedStatement> eldest)
Tells if an entry should be removed from the map.
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
public BoundedLinkedHashMap(int maxCapacity)
LinkedHashMap
with the specified maximum
size.
Iteration is by insertion-order.
maxCapacity
- maximum size of the mapprotected boolean removeEldestEntry(java.util.Map.Entry<StatementKey,java.sql.PreparedStatement> eldest)
If the cache has exceeded its maximum size, the oldest element will be marked for removal. The oldest element will be removed after the new element has been inserted.
removeEldestEntry
in class java.util.LinkedHashMap<StatementKey,java.sql.PreparedStatement>
eldest
- the element picked out for removaltrue
if the element is to be removed,
false
if not.Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.