Package org.apache.storm.utils
Class RotatingMap<K,V> 
java.lang.Object
org.apache.storm.utils.RotatingMap<K,V> 
Expires keys that have not been updated in the configured number of seconds. The algorithm used will take between expirationSecs and
 expirationSecs * (1 + 1 / (numBuckets-1)) to actually expire the message.
 
get, put, remove, containsKey, and size take O(numBuckets) time to run.
The advantage of this design is that the expiration thread only locks the object for O(1) time, meaning the object is essentially always available for gets/puts.
Note: This class is not thread-safe since it does not protect against changes to buckets while it is being read
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructorsConstructorDescriptionRotatingMap(int numBuckets) RotatingMap(int numBuckets, RotatingMap.ExpiredCallback<K, V> callback) RotatingMap(RotatingMap.ExpiredCallback<K, V> callback) 
- 
Method Summary
- 
Constructor Details- 
RotatingMap
- 
RotatingMap
- 
RotatingMappublic RotatingMap(int numBuckets) 
 
- 
- 
Method Details- 
rotate
- 
containsKey
- 
get
- 
put
- 
remove
- 
sizepublic int size()
 
-