KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > eviction > EvictionQueue


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.eviction;
8
9 import org.jboss.cache.Fqn;
10
11 import java.util.Iterator JavaDoc;
12
13
14 /**
15  * Eviction Queue interface defines a contract for the Eviction Queue implementations used by EvictionPolicies.
16  * <p/>
17  * Note: None of the Eviction classes are thread safe. It is assumed that an individual instance of an EvictionPolicy/
18  * EvictionAlgorithm/EvictionQueue/EvictionConfiguration are only operated on by one thread at any given time.
19  *
20  * @author Daniel Huang (dhuang@jboss.org)
21  * @version $Revision: 1.3 $
22  */

23 public interface EvictionQueue
24 {
25    /**
26     * Get the first entry in the queue.
27     * <p/>
28     * If there are no entries in queue, this method will return null.
29     * <p/>
30     * The first node returned is expected to be the first node to evict.
31     *
32     * @return first NodeEntry in queue.
33     */

34    public NodeEntry getFirstNodeEntry();
35
36    /**
37     * Retrieve a node entry by Fqn.
38     * <p/>
39     * This will return null if the entry is not found.
40     *
41     * @param fqn Fqn of the node entry to retrieve.
42     * @return Node Entry object associated with given Fqn param.
43     */

44    public NodeEntry getNodeEntry(Fqn fqn);
45
46    public NodeEntry getNodeEntry(String JavaDoc fqn);
47
48    /**
49     * Check if queue contains the given NodeEntry.
50     *
51     * @param entry NodeEntry to check for existence in queue.
52     * @return true/false if NodeEntry exists in queue.
53     */

54    public boolean containsNodeEntry(NodeEntry entry);
55
56    /**
57     * Remove a NodeEntry from queue.
58     * <p/>
59     * If the NodeEntry does not exist in the queue, this method will return normally.
60     *
61     * @param entry The NodeEntry to remove from queue.
62     */

63    public void removeNodeEntry(NodeEntry entry);
64
65    /**
66     * Add a NodeEntry to the queue.
67     *
68     * @param entry The NodeEntry to add to queue.
69     */

70    public void addNodeEntry(NodeEntry entry);
71
72    /**
73     * Get the number of nodes in the queue.
74     *
75     * @return The number of nodes in the queue.
76     */

77    public int getNumberOfNodes();
78
79    /**
80     * Get the number of elements in the queue.
81     *
82     * @return The number of elements in the queue.
83     */

84    public int getNumberOfElements();
85
86    public void modifyElementCount(int difference);
87
88    public Iterator JavaDoc iterate();
89
90    /**
91     * Clear the queue.
92     */

93    public void clear();
94
95 }
96
Popular Tags