java.io.Serializable
, java.lang.Cloneable
, java.util.Map<StatementKey,java.sql.PreparedStatement>
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 | Description |
---|---|---|
private int |
maxSize |
Maximum number of entries.
|
Constructor | Description |
---|---|
BoundedLinkedHashMap(int maxCapacity) |
Creates a bounded
LinkedHashMap with the specified maximum
size. |
Modifier and Type | Method | Description |
---|---|---|
protected boolean |
removeEldestEntry(java.util.Map.Entry<StatementKey,java.sql.PreparedStatement> eldest) |
Tells if an entry should be removed from the map.
|
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
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.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.