|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.jeri.internal.http.TimedMap
class TimedMap
Simple hash map which evicts entries after a fixed timeout. All operations which modify a TimedMap synchronize on the TimedMap instance itself, including the thread which evicts expired entries.
Nested Class Summary | |
---|---|
private class |
TimedMap.Evictor
Expired mapping eviction thread. |
private static class |
TimedMap.Mapping
Key/value mapping. |
private static class |
TimedMap.Queue
Lightweight doubly-linked queue supporting constant-time manipulation. |
Field Summary | |
---|---|
private boolean |
evictorActive
|
private TimedMap.Queue |
evictQueue
|
private Executor |
executor
|
private Map |
map
|
private long |
timeout
|
Constructor Summary | |
---|---|
TimedMap(Executor executor,
long timeout)
Creates empty TimedMap which uses threads from the given Executor to evict entries after the specified timeout. |
Method Summary | |
---|---|
(package private) void |
evicted(Object key,
Object value)
Upcall invoked after key's timeout has expired and key has been removed from the map. |
(package private) Object |
get(Object key)
Returns value associated with given key, or null if no mapping for key is found. |
(package private) Object |
put(Object key,
Object value)
Associates the given key with the given value, resetting the key's timeout. |
(package private) Object |
remove(Object key)
Removes mapping for key from map, returning the value associated with the key (or null if no mapping present). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Executor executor
private final long timeout
private final Map map
private final TimedMap.Queue evictQueue
private boolean evictorActive
Constructor Detail |
---|
TimedMap(Executor executor, long timeout)
Method Detail |
---|
Object put(Object key, Object value)
Object get(Object key)
Object remove(Object key)
void evicted(Object key, Object value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |