org.apache.camel
Interface TimeoutMap<K,V>

All Superinterfaces:
Runnable
All Known Implementing Classes:
DefaultTimeoutMap

public interface TimeoutMap<K,V>
extends Runnable

Represents a map of values which timeout after a period of inactivity.

Version:

Method Summary
 V get(K key)
          Looks up the value in the map by the given key.
 Object[] getKeys()
          Returns a copy of the keys in the map
 boolean 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
 V remove(K key)
          Removes the object with the given key
 int size()
          Returns the size of the map
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

get

V get(K key)
Looks up the value in the map by the given key.

Parameters:
key - the key of the value to search for
Returns:
the value for the given key or null if it is not present (or has timed out)

getKeys

Object[] getKeys()
Returns a copy of the keys in the map

Returns:
the keys

size

int size()
Returns the size of the map

Returns:
the size

put

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

Parameters:
key - the key
value - the value
timeoutMillis - timeout in millis

onEviction

boolean onEviction(K key,
                   V value)
Callback when the value has been evicted

Parameters:
key - the key
value - the value
Returns:
true to remove the evicted value, or false to veto the eviction and thus keep the value.

remove

V remove(K key)
Removes the object with the given key

Parameters:
key - key for the object to remove
Returns:
the value for the given key or null if it is not present (or has timed out)

purge

void purge()
Purges any old entries from the map



Apache CAMEL