com.atlassian.jira.util.collect
Class LRUMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<K,V>
              extended by com.atlassian.jira.util.collect.LRUMap<K,V>
Type Parameters:
K - key type
V - value type
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>

Deprecated. Since v6.2 Use CacheFactory instead and build a proper cache.

@Deprecated
@NotThreadSafe
public class LRUMap<K,V>
extends LinkedHashMap<K,V>
implements Map<K,V>

A subclass of LinkedHashMap that is access ordered AND constrained in size.

It is very important that any multi-threaded access to this class be externally synchronised as even non mutative operations such as LinkedHashMap.get(Object) will cause internal modifications to the map order.

See Also:
LinkedHashMap, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
static
<K,V> Map<K,V>
newLRUMap(int capacity)
          Deprecated. Get a map that is access ordered and has the specified capacity.
protected  boolean removeEldestEntry(Map.Entry<K,V> eldest)
          Deprecated.  
static
<K,V> Map<K,V>
synchronizedLRUMap(int capacity)
          Deprecated. Get a map that is access ordered and has the specified capacity that is thread-safe.
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

newLRUMap

public static <K,V> Map<K,V> newLRUMap(int capacity)
Deprecated. 
Get a map that is access ordered and has the specified capacity.

Type Parameters:
K - the key type
V - the value type
Parameters:
capacity - the maximum capacity
Returns:
an instance of LRUMap

synchronizedLRUMap

public static <K,V> Map<K,V> synchronizedLRUMap(int capacity)
Deprecated. 
Get a map that is access ordered and has the specified capacity that is thread-safe.

Type Parameters:
K - the key type
V - the value type
Parameters:
capacity - the maximum capacity
Returns:
an instance of LRUMap wrapped in a synchronized map.

removeEldestEntry

protected final boolean removeEldestEntry(Map.Entry<K,V> eldest)
Deprecated. 
Overrides:
removeEldestEntry in class LinkedHashMap<K,V>


Copyright © 2002-2014 Atlassian. All Rights Reserved.