org.jboss.cache.eviction
Interface EvictionQueue

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

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: 2054 $
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(String fqn)
           
 int getNumberOfElements()
          Get the number of elements in the queue.
 int getNumberOfNodes()
          Get the number of nodes in the queue.
 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(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

Iterator iterate()

clear

void clear()
Clear the queue.



Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.