1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| package org.jboss.cache.eviction; |
8 |
| |
9 |
| import org.apache.commons.logging.Log; |
10 |
| import org.apache.commons.logging.LogFactory; |
11 |
| import org.jboss.cache.Region; |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| public class FIFOAlgorithm extends BaseEvictionAlgorithm |
21 |
| { |
22 |
| private static final Log log = LogFactory.getLog(FIFOAlgorithm.class); |
23 |
| |
24 |
| |
25 |
52
| public FIFOAlgorithm()
|
26 |
| { |
27 |
52
| super();
|
28 |
| } |
29 |
| |
30 |
22
| protected EvictionQueue setupEvictionQueue(Region region) throws EvictionException
|
31 |
| { |
32 |
22
| return new FIFOQueue();
|
33 |
| } |
34 |
| |
35 |
| |
36 |
| |
37 |
| |
38 |
15605
| protected boolean shouldEvictNode(NodeEntry ne)
|
39 |
| { |
40 |
15605
| FIFOConfiguration config = (FIFOConfiguration) region.getEvictionPolicyConfig();
|
41 |
15605
| if (log.isTraceEnabled())
|
42 |
| { |
43 |
0
| log.trace("Deciding whether node in queue " + ne.getFqn() + " requires eviction.");
|
44 |
| } |
45 |
| |
46 |
15605
| int size = this.getEvictionQueue().getNumberOfNodes();
|
47 |
15605
| return config.getMaxNodes() != 0 && size > config.getMaxNodes();
|
48 |
| |
49 |
| } |
50 |
| |
51 |
| } |
52 |
| |