|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.camel.util.DefaultTimeoutMap<K,V>
public class DefaultTimeoutMap<K,V>
Default implementation of the TimeoutMap.
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
log
|
| Constructor Summary | |
|---|---|
DefaultTimeoutMap()
|
|
DefaultTimeoutMap(ScheduledExecutorService executor,
long requestMapPollTimeMillis)
|
|
| Method Summary | |
|---|---|
protected long |
currentTime()
|
V |
get(K key)
Looks up the value in the map by the given key. |
ScheduledExecutorService |
getExecutor()
|
Object[] |
getKeys()
Returns a copy of the keys in the map |
long |
getPurgePollTime()
|
protected boolean |
isValidForEviction(TimeoutMapEntry<K,V> entry)
A hook to allow derivations to avoid evicting the current entry |
void |
onEviction(K key,
V value)
Callback when the value has been evicted |
void |
purge()
Purges any old entries from the map |
void |
put(K key,
V value,
long timeoutMillis)
Adds the key value pair into the map such that some time after the given timeout the entry will be evicted |
void |
remove(K id)
Removes the object with the given key |
void |
run()
The timer task which purges old requests and schedules another poll |
protected void |
schedulePoll()
lets schedule each time to allow folks to change the time at runtime |
int |
size()
Returns the size of the map |
void |
start()
Starts the service |
void |
stop()
Stops the service |
protected void |
updateExpireTime(TimeoutMapEntry entry)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final transient org.apache.commons.logging.Log log
| Constructor Detail |
|---|
public DefaultTimeoutMap()
public DefaultTimeoutMap(ScheduledExecutorService executor,
long requestMapPollTimeMillis)
| Method Detail |
|---|
public V get(K key)
TimeoutMap
get in interface TimeoutMap<K,V>key - the key of the value to search for
public void put(K key,
V value,
long timeoutMillis)
TimeoutMap
put in interface TimeoutMap<K,V>key - the keyvalue - the valuetimeoutMillis - timeout in millispublic void remove(K id)
TimeoutMap
remove in interface TimeoutMap<K,V>id - key for the object to removepublic Object[] getKeys()
TimeoutMap
getKeys in interface TimeoutMap<K,V>public int size()
TimeoutMap
size in interface TimeoutMap<K,V>public void run()
run in interface Runnablepublic void purge()
TimeoutMap
purge in interface TimeoutMap<K,V>public long getPurgePollTime()
public ScheduledExecutorService getExecutor()
protected void schedulePoll()
protected boolean isValidForEviction(TimeoutMapEntry<K,V> entry)
public void onEviction(K key,
V value)
TimeoutMap
onEviction in interface TimeoutMap<K,V>key - the keyvalue - the valueprotected void updateExpireTime(TimeoutMapEntry entry)
protected long currentTime()
public void start()
throws Exception
Service
start in interface ServiceException - is thrown if starting failed
public void stop()
throws Exception
Service
stop in interface ServiceException - is thrown if stopping failed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||