org.jboss.cache.eviction
Class LRUAlgorithm

java.lang.Object
  |
  +--org.jboss.cache.eviction.LRUAlgorithm
All Implemented Interfaces:
EvictionAlgorithm
Direct Known Subclasses:
AopLRUAlgorithm, FIFOAlgorithm

public class LRUAlgorithm
extends java.lang.Object
implements EvictionAlgorithm

Least recently Used algorithm to purge old data. Note that this algorithm is not thread-safe.

Author:
Ben Wang 02-2004, Daniel Huang

Field Summary
protected  NodeEntry head_
           
protected  org.apache.commons.logging.Log log_
           
protected  java.util.Map nodeMap_
           
protected  EDU.oswego.cs.dl.util.concurrent.BoundedBuffer recycleQueue_
           
protected  Region region_
           
protected  NodeEntry tail_
           
 
Constructor Summary
LRUAlgorithm()
           
 
Method Summary
protected  void demote(Fqn fqn)
           
protected  void evict(Fqn fqn)
           
 int evictionQueueSize()
           
 void process(Region region)
          No lock is used here since we assume it is single-threaded access by the timer only.
protected  void prune()
           
 void resetEvictionQueue(Region region)
          Reset the whole eviction queue.
protected  boolean shouldEvictNode(NodeEntry entry, Region region, long currentTime)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log_

protected org.apache.commons.logging.Log log_

nodeMap_

protected java.util.Map nodeMap_

head_

protected NodeEntry head_

tail_

protected NodeEntry tail_

region_

protected Region region_

recycleQueue_

protected EDU.oswego.cs.dl.util.concurrent.BoundedBuffer recycleQueue_
Constructor Detail

LRUAlgorithm

public LRUAlgorithm()
Method Detail

process

public void process(Region region)
             throws EvictionException
No lock is used here since we assume it is single-threaded access by the timer only.

Specified by:
process in interface EvictionAlgorithm
Parameters:
region -
EvictionException

resetEvictionQueue

public void resetEvictionQueue(Region region)
Description copied from interface: EvictionAlgorithm
Reset the whole eviction queue. Queue may needs to be reset due to corrupted state, for example.

Specified by:
resetEvictionQueue in interface EvictionAlgorithm
Parameters:
region - Region that this algorithm will operate on.

demote

protected void demote(Fqn fqn)
               throws EvictionException
EvictionException

shouldEvictNode

protected boolean shouldEvictNode(NodeEntry entry,
                                  Region region,
                                  long currentTime)

prune

protected void prune()
              throws EvictionException
Throws:
EvictionException

evict

protected void evict(Fqn fqn)
              throws EvictionException
EvictionException

evictionQueueSize

public int evictionQueueSize()


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.