|
||||||||||
| 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 |
|---|
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(Object key)
|
boolean |
containsValue(Object value)
|
Set<Map.Entry<K,V>> |
entrySet()
|
boolean |
equals(Object obj)
|
V |
get(Object key)
|
int |
getExpirationInterval()
|
ExpiringMap.Expirer |
getExpirer()
|
int |
getTimeToLive()
|
int |
hashCode()
|
boolean |
isEmpty()
|
Set<K> |
keySet()
|
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> inMap)
|
V |
remove(Object key)
|
void |
removeExpirationListener(ExpirationListener<V> listener)
|
void |
setExpirationInterval(int expirationInterval)
|
void |
setTimeToLive(int timeToLive)
|
int |
size()
|
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 Map<K,V>public V get(Object key)
get in interface Map<K,V>public V remove(Object key)
remove in interface Map<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public int size()
size in interface Map<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>public void clear()
clear in interface Map<K,V>public int hashCode()
hashCode in interface Map<K,V>hashCode in class Objectpublic Set<K> keySet()
keySet in interface Map<K,V>public boolean equals(Object obj)
equals in interface Map<K,V>equals in class Objectpublic void putAll(Map<? extends K,? extends V> inMap)
putAll in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface 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 | |||||||||