Skip navigation links
oracle.javatools.util
Class Maps.ManagedCacheMap<K,V>
java.lang.Object
oracle.javatools.util.Maps.AbstractHashMap<K,V,E>
oracle.javatools.util.Maps.AbstractLinkedHashMap<K,V,Maps.LinkedEntry<K,V>>
oracle.javatools.util.Maps.CacheMap<K,V>
oracle.javatools.util.Maps.ManagedCacheMap<K,V>
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<K,V>, Maps.ManagedCacheMapMBean
- Enclosing class:
- Maps
-
public static class Maps.ManagedCacheMap<K,V>
- extends Maps.CacheMap<K,V>
- implements Maps.ManagedCacheMapMBean
A cache map which is an MBean and can be monitored by a JMX client (e.g., JConsole).
This map will be registered with the MBean server using the following object name, where name
is the name given in the constructor:
"oracle.javatools.cache:type=CacheMap,name="O___name____pre___tt___Typically__the_given_name_should_uniquely_identify_the_instance_object___which_contains_and_uses_the_map__If_that_instance_object_is_a_singleton____its_class_name_is_typically_sufficient__if_not__then_an_additional___distinguishing_property_should_be_appended__For_example__if_the_containing___instances_are_uniquely_characterized_by_a_URL_property__then_the_string___passed_to_the_constructor_could_be______tt__pre___getClass___getSimpleName_____",url=" + getUrl()
Notice how the URL is appended as an additional property, separated by a comma (",url="). This is not strictly required, but better fits standard JMX object naming conventions. Also note that if the value contains certain characters (for example, a file path if a URL contained a "?" or a file name contained a "\", see ObjectName
), it must be quoted using ObjectName.quote(java.lang.String)
.
- See Also:
ObjectName
, Serialized Form
Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
Constructor Summary |
Maps.ManagedCacheMap(int bound, Maps.CacheMap.Strength strength, java.lang.String name)
Constructs a bounded LRU (least recently used) cache map. |
Maps.ManagedCacheMap(int bound, java.lang.String name)
Constructs a bounded LRU (least recently used), canonical, cache map of strongly-referenced values. |
Maps.ManagedCacheMap(Maps.CacheMap.Strength strength, java.lang.String name)
Constructs an unbounded, non-canonical cache map. |
Maps.ManagedCacheMap(Maps.CacheStrategy<K,V> strategy, java.lang.String name)
Constructs a cache map. |
Maps.ManagedCacheMap(java.lang.String name)
Constructs an unbounded, non-canonical cache map of strongly-referenced values. |
Methods inherited from class oracle.javatools.util.Maps.CacheMap |
clear, createEntry, entryAccessed, entryAdded, entryChanged, entryEvicted, entryPurged, entryRemoved, evictEntry, getEldestEntry, mapChanged, removeEldestEntry |
Methods inherited from class oracle.javatools.util.Maps.AbstractHashMap |
addEntry, capacity, change, clone, containsKey, containsValue, entrySet, equals, get, getChangeCount, getEntry, getQueue, hashCode, isEmpty, keyEquals, keyHashCode, keySet, loadFactor, mapConstructed, mapInitialized, purge, purgeEntry, put, putAll, remove, removeExistingEntry, removeKey, size, toString, valueEquals, valueHashCode, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Maps.ManagedCacheMap
public Maps.ManagedCacheMap(java.lang.String name)
- Constructs an unbounded, non-canonical cache map of strongly-referenced values. The initial capacity and load factor are set to default
values
.
- Parameters:
name
- The unique name of this cache (see Maps.ManagedCacheMap
).
Maps.ManagedCacheMap
public Maps.ManagedCacheMap(Maps.CacheMap.Strength strength,
java.lang.String name)
- Constructs an unbounded, non-canonical cache map. The initial capacity and load factor are set to default
values
.
- Parameters:
strength
- The default strength of value references.
name
- The unique name of this cache (see Maps.ManagedCacheMap
).
Maps.ManagedCacheMap
public Maps.ManagedCacheMap(int bound,
java.lang.String name)
- Constructs a bounded LRU (least recently used), canonical, cache map of strongly-referenced values. The initial capacity and load factor are set to default
values
.
- Parameters:
bound
- The maximum number of entries allowed in the cache.
name
- The unique name of this cache (see Maps.ManagedCacheMap
).
Maps.ManagedCacheMap
public Maps.ManagedCacheMap(int bound,
Maps.CacheMap.Strength strength,
java.lang.String name)
- Constructs a bounded LRU (least recently used) cache map. The initial capacity and load factor are set to default
values
.
- Parameters:
bound
- The maximum number of entries allowed in the cache.
strength
- The default strength of value references.
name
- The unique name of this cache (see Maps.ManagedCacheMap
).
Maps.ManagedCacheMap
public Maps.ManagedCacheMap(Maps.CacheStrategy<K,V> strategy,
java.lang.String name)
- Constructs a cache map.
- Parameters:
strategy
- The cache strategy to use.
name
- The unique name of this cache (see Maps.ManagedCacheMap
).
decoratedStrategy
protected Maps.CacheStrategy<K,V> decoratedStrategy(Maps.CacheStrategy<K,V> strategy)
- Description copied from class:
Maps.CacheMap
- Invoked by the
Maps.CacheMap
constructor to allow a subclass to replace the strategy passed to the constructor. The default Maps.CacheMap
implementation returns the strategy passed to it.
This hook is provided to allow a subclass to decorate a strategy given to its constructor without running afoul of superclass-not- initialized issues.
-
- Overrides:
decoratedStrategy
in class Maps.CacheMap<K,V>
-
- Parameters:
strategy
- The strategy passed to the CacheMap constructor.
- Returns:
- the strategy passed to the constructor or a subclass-provided replacement.
getSize
public int getSize()
-
- Specified by:
getSize
in interface Maps.ManagedCacheMapMBean
getMaximumSize
public int getMaximumSize()
-
- Specified by:
getMaximumSize
in interface Maps.ManagedCacheMapMBean
getStatistics
public javax.management.openmbean.CompositeData getStatistics()
throws javax.management.openmbean.OpenDataException
-
- Specified by:
getStatistics
in interface Maps.ManagedCacheMapMBean
-
- Throws:
javax.management.openmbean.OpenDataException
setCollectKeyStatistics
public void setCollectKeyStatistics(boolean collect)
-
- Specified by:
setCollectKeyStatistics
in interface Maps.ManagedCacheMapMBean
getCollectKeyStatistics
public boolean getCollectKeyStatistics()
-
- Specified by:
getCollectKeyStatistics
in interface Maps.ManagedCacheMapMBean
getTotalKeyCount
public int getTotalKeyCount()
-
- Specified by:
getTotalKeyCount
in interface Maps.ManagedCacheMapMBean
getKeyStatistics
public javax.management.openmbean.TabularData getKeyStatistics()
throws javax.management.openmbean.OpenDataException
-
- Specified by:
getKeyStatistics
in interface Maps.ManagedCacheMapMBean
-
- Throws:
javax.management.openmbean.OpenDataException
clearKeyStatistics
public void clearKeyStatistics()
-
- Specified by:
clearKeyStatistics
in interface Maps.ManagedCacheMapMBean
Skip navigation links
Copyright © 1997, 2013, Oracle. All rights reserved.