|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<K,V>
com.google.code.rees.scope.util.monitor.HashMonitoredContext<K,V,T>
public abstract class HashMonitoredContext<K,V,T extends MonitoredContext<K,V,T>>
A Serializable Hash implementation of the Map and Timeoutable interfaces.
Resets its own remaining time whenever the wrapped HashMap is
accessed.
| 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> |
| Field Summary | |
|---|---|
protected long |
maxIdleTime
|
protected long |
timeOfMostRecentAccess
|
protected Collection<TimeoutListener<T>> |
timeoutListeners
|
| Constructor Summary | |
|---|---|
HashMonitoredContext(long maxIdleTime)
|
|
| Method Summary | |
|---|---|
void |
addTimeoutListener(TimeoutListener<T> timeoutListener)
Add a listener whose TimeoutListener.onTimeout(Object) method will be called when this Timeoutable's
Timeoutable.timeout() method is called. |
Set<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
|
long |
getRemainingTime()
The time remaining until this Timeoutable's Timeoutable.timeout() method will be called |
Set<K> |
keySet()
|
protected void |
ping()
|
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> m)
|
V |
remove(Object key)
|
void |
reset()
Resets this Timeoutable's remaining time to the max idle time |
void |
setMaxIdleTime(long maxIdleTime)
Sets the time after which this Timeoutable's Timeoutable.timeout() method will be called |
void |
timeout()
Called when this Timeoutable's Timeoutable.getRemainingTime() is equal to or less than zero (i.e. |
Collection<V> |
values()
|
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, containsKey, containsValue, isEmpty, size |
| 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, equals, hashCode, isEmpty, size |
| Methods inherited from interface com.google.code.rees.scope.util.monitor.Timeoutable |
|---|
getId |
| Field Detail |
|---|
protected Collection<TimeoutListener<T extends MonitoredContext<K,V,T>>> timeoutListeners
protected long timeOfMostRecentAccess
protected long maxIdleTime
| Constructor Detail |
|---|
public HashMonitoredContext(long maxIdleTime)
| Method Detail |
|---|
public V get(Object key)
get in interface Map<K,V>get in class HashMap<K,V>
public V put(K key,
V value)
put in interface Map<K,V>put in class HashMap<K,V>public void putAll(Map<? extends K,? extends V> m)
putAll in interface Map<K,V>putAll in class HashMap<K,V>public Collection<V> values()
values in interface Map<K,V>values in class HashMap<K,V>public V remove(Object key)
remove in interface Map<K,V>remove in class HashMap<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>entrySet in class HashMap<K,V>public Set<K> keySet()
keySet in interface Map<K,V>keySet in class HashMap<K,V>public long getRemainingTime()
Timeoutable.timeout() method will be called
getRemainingTime in interface Timeoutable<T extends MonitoredContext<K,V,T>>public void reset()
reset in interface Timeoutable<T extends MonitoredContext<K,V,T>>public void setMaxIdleTime(long maxIdleTime)
Timeoutable.timeout() method will be called
setMaxIdleTime in interface Timeoutable<T extends MonitoredContext<K,V,T>>public void addTimeoutListener(TimeoutListener<T> timeoutListener)
TimeoutListener.onTimeout(Object) method will be called when this Timeoutable's
Timeoutable.timeout() method is called.
addTimeoutListener in interface Timeoutable<T extends MonitoredContext<K,V,T>>public void timeout()
Timeoutable.getRemainingTime() is equal to or less than zero (i.e. the max idle time has been exceeded).
timeout in interface Timeoutable<T extends MonitoredContext<K,V,T>>protected void ping()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||