Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Apr 22, 2010
1 parent 97d60fe commit 7b71729
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/org/jgroups/blocks/LazyRemovalCache.java
Expand Up @@ -10,7 +10,7 @@
* configurable time are evicted. Elements are marked as removable by remove(), removeAll() and retainAll(). When
* an elements is marked as removable, but later reinserted, the mark is removed.
* @author Bela Ban
* @version $Id: LazyRemovalCache.java,v 1.5 2010/04/22 06:25:28 belaban Exp $
* @version $Id: LazyRemovalCache.java,v 1.6 2010/04/22 12:13:06 belaban Exp $
*/
public class LazyRemovalCache<K,V> {
private final ConcurrentMap<K,Entry<V>> map=new ConcurrentHashMap<K,Entry<V>>();
Expand Down Expand Up @@ -195,6 +195,8 @@ public void removeMarkedElements(boolean force) {
for(Iterator<Map.Entry<K,Entry<V>>> it=map.entrySet().iterator(); it.hasNext();) {
Map.Entry<K, Entry<V>> entry=it.next();
Entry<V> tmp=entry.getValue();
if(tmp == null)
continue;
if(tmp.removable && (curr_time - tmp.timestamp) >= max_age || force) {
it.remove();
}
Expand Down

0 comments on commit 7b71729

Please sign in to comment.