Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.cache.eviction
Class BaseSortedEvictionAlgorithm

    java.lang.Object
      org.jboss.cache.eviction.BaseEvictionAlgorithm
          org.jboss.cache.eviction.BaseSortedEvictionAlgorithm

All Implemented Interfaces:
  EvictionAlgorithm

Direct Known Subclasses:
  ElementSizeAlgorithm, LFUAlgorithm

    public abstract class BaseSortedEvictionAlgorithm

extends BaseEvictionAlgorithm
implements EvictionAlgorithm

An abstract SortedEvictionAlgorithm.

This class supports early termination of the eviction queue processing. Because the eviction queue is sorted by first to evict to last to evict, when iterating the eviction queue, the first time a node is encountered that does not require eviction will terminate the loop early. This way we don't incur the full breadth of the O(n) = n operation everytime we need to check for eviction (defined by eviction poll time interval).

Author:
  Daniel Huang - dhuang@jboss.org - 10/2005

Field Summary

Fields inherited from class org.jboss.cache.eviction.BaseEvictionAlgorithm
`evictionQueue, recycleQueue, region`

Constructor Summary
`BaseSortedEvictionAlgorithm()`

Method Summary
`void` | `process(Region region)` Process the given region.
`protected void` | `processQueues(Region region)` Event processing for Evict/Add/Visiting of nodes.
`protected void` | `resortEvictionQueue(boolean evictionQueueModified)` This method is called to resort the queue after add or visit events have occurred.

Methods inherited from class org.jboss.cache.eviction.BaseEvictionAlgorithm
`emptyRecycleQueue, evict, evictCacheNode, getEvictionQueue, initialize, isNodeInUseAndNotTimedOut, processAddedElement, processAddedNodes, processMarkInUseNodes, processRemovedElement, processRemovedNodes, processUnmarkInUseNodes, processVisitedNodes, prune, resetEvictionQueue, setupEvictionQueue, shouldEvictNode`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jboss.cache.eviction.EvictionAlgorithm
`getEvictionQueue, resetEvictionQueue`

Constructor Detail

### BaseSortedEvictionAlgorithm

    public BaseSortedEvictionAlgorithm()

Method Detail

### process

    public void process(Region region)
                 throws EvictionException

  Description copied from class: `BaseEvictionAlgorithm`
  Process the given region.

  Eviction Processing encompasses the following:

  - Add/Remove/Visit Nodes - Prune according to Eviction Algorithm - Empty/Retry the recycle queue of previously evicted but locked (during actual cache eviction) nodes.

  Specified by:
    `process` in interface `EvictionAlgorithm`
  Overrides:
    `process` in class `BaseEvictionAlgorithm`
  Parameters:
    `region` - Cache region to process for eviction.
  Throws:
    `EvictionException`

### processQueues

    protected void processQueues(Region region)
                          throws EvictionException

  Description copied from class: `BaseEvictionAlgorithm`
  Event processing for Evict/Add/Visiting of nodes.

  - On AddEvents a new element is added into the eviction queue - On RemoveEvents, the removed element is removed from the eviction queue. - On VisitEvents, the visited node has its eviction statistics updated (idleTime, numberOfNodeVisists, etc..)

  Overrides:
    `processQueues` in class `BaseEvictionAlgorithm`
  Parameters:
    `region` - Cache region to process for eviction.
  Throws:
    `EvictionException`

### resortEvictionQueue

    protected void resortEvictionQueue(boolean evictionQueueModified)

  This method is called to resort the queue after add or visit events have occurred.

  If the parameter is true, the queue needs to be resorted. If it is false, the queue does not need resorting.

  Parameters:
    `evictionQueueModified` - True if the queue was added to or visisted during event processing.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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