|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.util.Maps.CacheStrategy<K,V,E>
public abstract static class Maps.CacheStrategy<K,V,E extends Maps.AbstractLinkedEntry<K,V>>
An abstract caching strategy for a cache map
.
Field Summary | |
---|---|
static Maps.AbstractCacheMap.MappingType |
CANONICAL
|
static int |
DEFAULT_INITIAL_CAPACITY
|
static float |
DEFAULT_LOAD_FACTOR
|
static Maps.AbstractCacheMap.ReferenceType |
HARD
|
static Maps.AbstractCacheMap.MappingType |
NONCANONICAL
|
static Maps.AbstractCacheMap.ReferenceType |
SOFT
|
static Maps.AbstractCacheMap.ReferenceType |
WEAK
|
Constructor Summary | |
---|---|
protected |
Maps.CacheStrategy(int initialCapacity,
float loadFactor,
Maps.AbstractCacheMap.ReferenceType valueReferenceType,
Maps.AbstractCacheMap.MappingType mappingType)
Constructs a cache strategy. |
Method Summary | |
---|---|
protected void |
entryAccessed(Maps.AbstractCacheMap<K,V,E> map,
E entry)
Invoked when the value of an existing entry is accessed by Maps.AbstractHashMap.get(java.lang.Object) . |
protected void |
entryAdded(Maps.AbstractCacheMap<K,V,E> map,
E entry)
Invoked when a new entry is added to this map, when entries are added by Maps.AbstractHashMap.put(K, V) . |
protected void |
entryChanged(Maps.AbstractCacheMap<K,V,E> map,
E oldEntry,
V oldValue,
E newEntry)
Invoked when the value of an existing entry is changed, when entries are changed by Maps.AbstractHashMap.put(K, V) or evicted but not removed by
Maps.AbstractCacheMap.evictExistingEntry(E) . |
protected void |
entryEvicted(Maps.AbstractCacheMap<K,V,E> map,
E entry)
Invoked when an existing entry is evicted by Maps.AbstractCacheMap.evictExistingEntry(E) (e.g., because evictEldest(oracle.javatools.util.Maps.AbstractCacheMap returned
true) and the map is not canonical. |
protected void |
entryPurged(Maps.AbstractCacheMap<K,V,E> map,
E entry)
Invoked when an existing entry is purged after its value has been garbage collected. |
protected void |
entryRemoved(Maps.AbstractCacheMap<K,V,E> map,
E entry)
Invoked when an existing entry is removed by a remove method of this map, of a view collection of this map, or of an iterator of a view collection of this map The Maps.AbstractCacheMap implementation never invokes entryRemoved(oracle.javatools.util.Maps.AbstractCacheMap
when entries are removed by the Maps.AbstractLinkedHashMap.clear() method of this
map, or of a view collection of this map. |
protected boolean |
evictEldest(Maps.AbstractCacheMap<K,V,E> map,
E eldest)
Gets whether to evict the eldest entry from a cache. |
int |
getInitialCapacity()
Gets the initial capacity of the cache map. |
float |
getLoadFactor()
Gets the load factor of the cache map. |
Maps.AbstractCacheMap.MappingType |
getMappingType()
Gets whether the cache maps canonically. |
Maps.AbstractCacheMap.ReferenceType |
getValueReferenceType()
Gets the value reference type of the cache map. |
protected void |
mapChanged(Maps.AbstractCacheMap<K,V,E> map)
Invoked when the map has changed, when entries are added, removed, or accessed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_INITIAL_CAPACITY
public static final float DEFAULT_LOAD_FACTOR
public static final Maps.AbstractCacheMap.ReferenceType HARD
public static final Maps.AbstractCacheMap.ReferenceType SOFT
public static final Maps.AbstractCacheMap.ReferenceType WEAK
public static final Maps.AbstractCacheMap.MappingType CANONICAL
public static final Maps.AbstractCacheMap.MappingType NONCANONICAL
Constructor Detail |
---|
protected Maps.CacheStrategy(int initialCapacity, float loadFactor, Maps.AbstractCacheMap.ReferenceType valueReferenceType, Maps.AbstractCacheMap.MappingType mappingType)
Method Detail |
---|
public int getInitialCapacity()
public float getLoadFactor()
public Maps.AbstractCacheMap.ReferenceType getValueReferenceType()
public Maps.AbstractCacheMap.MappingType getMappingType()
protected void mapChanged(Maps.AbstractCacheMap<K,V,E> map)
entryAdded(oracle.javatools.util.Maps.AbstractCacheMap, E)
, entryRemoved(oracle.javatools.util.Maps.AbstractCacheMap, E)
, or entryAccessed(oracle.javatools.util.Maps.AbstractCacheMap, E)
method is
invoked.
The Maps.CacheStrategy
implementation does nothing.
protected void entryAdded(Maps.AbstractCacheMap<K,V,E> map, E entry)
Maps.AbstractHashMap.put(K, V)
.
The Maps.CacheStrategy
implementation does nothing.
protected void entryChanged(Maps.AbstractCacheMap<K,V,E> map, E oldEntry, V oldValue, E newEntry)
Maps.AbstractHashMap.put(K, V)
or evicted but not removed by
Maps.AbstractCacheMap.evictExistingEntry(E)
.
If the entry to change was mutable, its value is changed with Map.Entry#setValue
and oldEntry and newEntry are the
same object. If the entry to change was not mutable, a new entry
must be created and oldEntry and newEntry are
different objects.
When a client directly invokes the Map.Entry#setValue
method of
any of the Map.Entry
implementations provided in this class,
this method is not invoked (while this could be addressed, it would
require each entry instance to hold a reference to its map).
The Maps.CacheStrategy
implementation does nothing.
oldEntry
- The existing entry that changed.oldValue
- The old value of the entry.newEntry
- The new entry, which may be the same as the old.protected void entryAccessed(Maps.AbstractCacheMap<K,V,E> map, E entry)
Maps.AbstractHashMap.get(java.lang.Object)
. Access to an entry by iterating a view collection of this
map does not cause this method to be invoked.
The Maps.CacheStrategy
implementation does nothing.
protected void entryRemoved(Maps.AbstractCacheMap<K,V,E> map, E entry)
Maps.AbstractCacheMap
implementation never invokes entryRemoved(oracle.javatools.util.Maps.AbstractCacheMap, E)
when entries are removed by the Maps.AbstractLinkedHashMap.clear()
method of this
map, or of a view collection of this map.
The Maps.CacheStrategy
implementation does nothing.
protected void entryPurged(Maps.AbstractCacheMap<K,V,E> map, E entry)
Maps.AbstractCacheMap
implementation only ever invokes entryPurged(oracle.javatools.util.Maps.AbstractCacheMap, E)
for entries which extend SoftReference
or
WeakReference
and which register themselves with the
ReferenceQueue
returned by Maps.AbstractHashMap.getQueue()
.
Maps
provides four such classes: Maps.SoftEntry
,
Maps.WeakEntry
, Maps.SoftLinkedEntry
, and Maps.WeakLinkedEntry
.
The Maps.CacheStrategy
implementation does nothing.
protected void entryEvicted(Maps.AbstractCacheMap<K,V,E> map, E entry)
Maps.AbstractCacheMap.evictExistingEntry(E)
(e.g., because evictEldest(oracle.javatools.util.Maps.AbstractCacheMap, E)
returned
true) and the map is not canonical.
The Maps.CacheStrategy
implementation does nothing.
protected boolean evictEldest(Maps.AbstractCacheMap<K,V,E> map, E eldest)
entryAdded(oracle.javatools.util.Maps.AbstractCacheMap, E)
is invoked, but not
if entryAdded(oracle.javatools.util.Maps.AbstractCacheMap, E)
modifies the map.
The Maps.CacheStrategy
implementation returns false.
eldest
- The eldest entry in the map, potentially to be evicted.
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |