|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mina.util.ExpiringMap<K,V>
public class ExpiringMap<K,V>
A map with expiration. This class contains a worker thread that will periodically check this class in order to determine if any objects should be removed based on the provided time-to-live value.
| Nested Class Summary | |
|---|---|
class |
ExpiringMap.Expirer
A Thread that monitors an ExpiringMap and will remove
elements that have passed the threshold. |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Field Summary | |
|---|---|
static int |
DEFAULT_EXPIRATION_INTERVAL
The default value, 1 |
static int |
DEFAULT_TIME_TO_LIVE
The default value, 60 |
| Constructor Summary | |
|---|---|
ExpiringMap()
Creates a new instance of ExpiringMap using the default values DEFAULT_TIME_TO_LIVE and DEFAULT_EXPIRATION_INTERVAL |
|
ExpiringMap(int timeToLive)
Creates a new instance of ExpiringMap using the supplied time-to-live value and the default value for DEFAULT_EXPIRATION_INTERVAL |
|
ExpiringMap(int timeToLive,
int expirationInterval)
Creates a new instance of ExpiringMap using the supplied values and a ConcurrentHashMap for the internal data structure. |
|
| Method Summary | |
|---|---|
void |
addExpirationListener(ExpirationListener<V> listener)
|
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
boolean |
equals(java.lang.Object obj)
|
V |
get(java.lang.Object key)
|
int |
getExpirationInterval()
|
ExpiringMap.Expirer |
getExpirer()
|
int |
getTimeToLive()
|
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Set<K> |
keySet()
|
V |
put(K key,
V value)
|
void |
putAll(java.util.Map<? extends K,? extends V> inMap)
|
V |
remove(java.lang.Object key)
|
void |
removeExpirationListener(ExpirationListener<V> listener)
|
void |
setExpirationInterval(int expirationInterval)
|
void |
setTimeToLive(int timeToLive)
|
int |
size()
|
java.util.Collection<V> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_TIME_TO_LIVE
public static final int DEFAULT_EXPIRATION_INTERVAL
| Constructor Detail |
|---|
public ExpiringMap()
public ExpiringMap(int timeToLive)
timeToLive - The time-to-live value (seconds)
public ExpiringMap(int timeToLive,
int expirationInterval)
ConcurrentHashMap for the internal data structure.
timeToLive - The time-to-live value (seconds)expirationInterval - The time between checks to see if a value should be removed (seconds)| Method Detail |
|---|
public V put(K key,
V value)
put in interface java.util.Map<K,V>public V get(java.lang.Object key)
get in interface java.util.Map<K,V>public V remove(java.lang.Object key)
remove in interface java.util.Map<K,V>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,V>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<K,V>public int size()
size in interface java.util.Map<K,V>public boolean isEmpty()
isEmpty in interface java.util.Map<K,V>public void clear()
clear in interface java.util.Map<K,V>public int hashCode()
hashCode in interface java.util.Map<K,V>hashCode in class java.lang.Objectpublic java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>public boolean equals(java.lang.Object obj)
equals in interface java.util.Map<K,V>equals in class java.lang.Objectpublic void putAll(java.util.Map<? extends K,? extends V> inMap)
putAll in interface java.util.Map<K,V>public java.util.Collection<V> values()
values in interface java.util.Map<K,V>public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>public void addExpirationListener(ExpirationListener<V> listener)
public void removeExpirationListener(ExpirationListener<V> listener)
public ExpiringMap.Expirer getExpirer()
public int getExpirationInterval()
public int getTimeToLive()
public void setExpirationInterval(int expirationInterval)
public void setTimeToLive(int timeToLive)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||