|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
com.reardencommerce.kernel.collections.shared.evictable.ConcurrentLinkedHashMap<K,V>
public final class ConcurrentLinkedHashMap<K,V>
A ConcurrentMap with a doubly-linked list running through its entries.
This class provides the same semantics as a ConcurrentHashMap in terms of
iterators, acceptable keys, and concurrency characteristics, but perform slightly
worse due to the added expense of maintaining the linked list. It differs from
LinkedHashMap in that it does not provide predictable iteration
order.
This map is intended to be used for caches and provides the following eviction policies:
http://code.google.com/p/concurrentlinkedhashmap/,
Serialized Form| Nested Class Summary | |
|---|---|
static interface |
ConcurrentLinkedHashMap.EvictionListener<K,V>
A listener registered for notification when an entry is evicted. |
static class |
ConcurrentLinkedHashMap.EvictionPolicy
The replacement policy to apply to determine which entry to discard when the capacity has been reached. |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Method Summary | ||
|---|---|---|
int |
capacity()
Retrieves the maximum capacity of the map. |
|
void |
clear()
|
|
boolean |
containsKey(java.lang.Object key)
|
|
boolean |
containsValue(java.lang.Object value)
|
|
static
|
create(ConcurrentLinkedHashMap.EvictionPolicy policy,
int maximumCapacity)
Creates a map with the specified eviction policy, maximum capacity, and at the default concurrency level. |
|
static
|
create(ConcurrentLinkedHashMap.EvictionPolicy policy,
int maximumCapacity,
ConcurrentLinkedHashMap.EvictionListener<K,V> listener)
Creates a map with the specified eviction policy, maximum capacity, eviction listener, and at the default concurrency level. |
|
static
|
create(ConcurrentLinkedHashMap.EvictionPolicy policy,
int maximumCapacity,
int concurrencyLevel)
Creates a map with the specified eviction policy, maximum capacity, and concurrency level. |
|
static
|
create(ConcurrentLinkedHashMap.EvictionPolicy policy,
int maximumCapacity,
int concurrencyLevel,
ConcurrentLinkedHashMap.EvictionListener<K,V> listener)
Creates a map with the specified eviction policy, maximum capacity, eviction listener, and concurrency level. |
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
|
V |
get(java.lang.Object key)
|
|
java.util.Set<K> |
keySet()
|
|
V |
put(K key,
V value)
|
|
V |
putIfAbsent(K key,
V value)
|
|
V |
remove(java.lang.Object key)
|
|
boolean |
remove(java.lang.Object key,
java.lang.Object value)
|
|
V |
replace(K key,
V value)
|
|
boolean |
replace(K key,
V oldValue,
V newValue)
|
|
void |
setCapacity(int capacity)
Sets the maximum capacity of the map and eagerly evicts entries until it shrinks to the appropriate size. |
|
int |
size()
|
|
java.util.Collection<V> |
values()
|
|
| Methods inherited from class java.util.AbstractMap |
|---|
clone, equals, hashCode, isEmpty, putAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode, isEmpty, putAll |
| Method Detail |
|---|
public static <K,V> ConcurrentLinkedHashMap<K,V> create(ConcurrentLinkedHashMap.EvictionPolicy policy,
int maximumCapacity)
policy - The eviction policy to apply when the size exceeds the maximum capacity.maximumCapacity - The maximum capacity to coerces to. The size may exceed it temporarily.
public static <K,V> ConcurrentLinkedHashMap<K,V> create(ConcurrentLinkedHashMap.EvictionPolicy policy,
int maximumCapacity,
ConcurrentLinkedHashMap.EvictionListener<K,V> listener)
policy - The eviction policy to apply when the size exceeds the maximum capacity.maximumCapacity - The maximum capacity to coerces to. The size may exceed it temporarily.listener - The listener registered for notification when an entry is evicted.
public static <K,V> ConcurrentLinkedHashMap<K,V> create(ConcurrentLinkedHashMap.EvictionPolicy policy,
int maximumCapacity,
int concurrencyLevel)
policy - The eviction policy to apply when the size exceeds the maximum capacity.maximumCapacity - The maximum capacity to coerces to. The size may exceed it temporarily.concurrencyLevel - The estimated number of concurrently updating threads. The implementation
performs internal sizing to try to accommodate this many threads.
public static <K,V> ConcurrentLinkedHashMap<K,V> create(ConcurrentLinkedHashMap.EvictionPolicy policy,
int maximumCapacity,
int concurrencyLevel,
ConcurrentLinkedHashMap.EvictionListener<K,V> listener)
policy - The eviction policy to apply when the size exceeds the maximum capacity.maximumCapacity - The maximum capacity to coerces to. The size may exceed it temporarily.concurrencyLevel - The estimated number of concurrently updating threads. The implementation
performs internal sizing to try to accommodate this many threads.listener - The listener registered for notification when an entry is evicted.public void setCapacity(int capacity)
capacity - The maximum capacity of the map.public int capacity()
public int size()
size in interface java.util.Map<K,V>size in class java.util.AbstractMap<K,V>public void clear()
clear in interface java.util.Map<K,V>clear in class java.util.AbstractMap<K,V>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,V>containsKey in class java.util.AbstractMap<K,V>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<K,V>containsValue in class java.util.AbstractMap<K,V>public V get(java.lang.Object key)
get in interface java.util.Map<K,V>get in class java.util.AbstractMap<K,V>
public V put(K key,
V value)
put in interface java.util.Map<K,V>put in class java.util.AbstractMap<K,V>
public V putIfAbsent(K key,
V value)
putIfAbsent in interface java.util.concurrent.ConcurrentMap<K,V>public V remove(java.lang.Object key)
remove in interface java.util.Map<K,V>remove in class java.util.AbstractMap<K,V>
public boolean remove(java.lang.Object key,
java.lang.Object value)
remove in interface java.util.concurrent.ConcurrentMap<K,V>
public V replace(K key,
V value)
replace in interface java.util.concurrent.ConcurrentMap<K,V>
public boolean replace(K key,
V oldValue,
V newValue)
replace in interface java.util.concurrent.ConcurrentMap<K,V>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>keySet in class java.util.AbstractMap<K,V>public java.util.Collection<V> values()
values in interface java.util.Map<K,V>values in class java.util.AbstractMap<K,V>public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>entrySet in class java.util.AbstractMap<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||