org.jboss.cache.eviction
Interface EvictionQueue

All Known Subinterfaces:
SortedEvictionQueue
All Known Implementing Classes:
ElementSizeQueue, FIFOQueue, LFUQueue, LRUQueue, MRUQueue

public interface EvictionQueue

Eviction Queue interface defines a contract for the Eviction Queue implementations used by EvictionPolicies.

Note: None of the Eviction classes are thread safe. It is assumed that an individual instance of an EvictionPolicy/ EvictionAlgorithm/EvictionQueue/EvictionConfiguration are only operated on by one thread at any given time.

Version:
$Revision: 1.3 $
Author:
Daniel Huang (dhuang@jboss.org)

Method Summary
 void addNodeEntry(NodeEntry entry)
          Add a NodeEntry to the queue.
 void clear()
          Clear the queue.
 boolean containsNodeEntry(NodeEntry entry)
          Check if queue contains the given NodeEntry.
 NodeEntry getFirstNodeEntry()
          Get the first entry in the queue.
 NodeEntry getNodeEntry(Fqn fqn)
          Retrieve a node entry by Fqn.
 NodeEntry getNodeEntry(java.lang.String fqn)
           
 int getNumberOfElements()
          Get the number of elements in the queue.
 int getNumberOfNodes()
          Get the number of nodes in the queue.
 java.util.Iterator iterate()
           
 void modifyElementCount(int difference)
           
 void removeNodeEntry(NodeEntry entry)
          Remove a NodeEntry from queue.
 

Method Detail

getFirstNodeEntry

NodeEntry getFirstNodeEntry()
Get the first entry in the queue.

If there are no entries in queue, this method will return null.

The first node returned is expected to be the first node to evict.

Returns:
first NodeEntry in queue.

getNodeEntry

NodeEntry getNodeEntry(Fqn fqn)
Retrieve a node entry by Fqn.

This will return null if the entry is not found.

Parameters:
fqn - Fqn of the node entry to retrieve.
Returns:
Node Entry object associated with given Fqn param.

getNodeEntry

NodeEntry getNodeEntry(java.lang.String fqn)

containsNodeEntry

boolean containsNodeEntry(NodeEntry entry)
Check if queue contains the given NodeEntry.

Parameters:
entry - NodeEntry to check for existence in queue.
Returns:
true/false if NodeEntry exists in queue.

removeNodeEntry

void removeNodeEntry(NodeEntry entry)
Remove a NodeEntry from queue.

If the NodeEntry does not exist in the queue, this method will return normally.

Parameters:
entry - The NodeEntry to remove from queue.

addNodeEntry

void addNodeEntry(NodeEntry entry)
Add a NodeEntry to the queue.

Parameters:
entry - The NodeEntry to add to queue.

getNumberOfNodes

int getNumberOfNodes()
Get the number of nodes in the queue.

Returns:
The number of nodes in the queue.

getNumberOfElements

int getNumberOfElements()
Get the number of elements in the queue.

Returns:
The number of elements in the queue.

modifyElementCount

void modifyElementCount(int difference)

iterate

java.util.Iterator iterate()

clear

void clear()
Clear the queue.



Copyright 1998-2005 JBoss Inc . All Rights Reserved.