Author: dereed
Date: 2010-04-07 17:35:13 -0400 (Wed, 07 Apr 2010)
New Revision: 8363
Modified:
core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
core/trunk/src/main/java/org/jboss/cache/eviction/MRUAlgorithm.java
Log:
[JBCACHE-1576] Fix handling of maxNodes == 0 or -1
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java 2010-04-07
21:15:40 UTC (rev 8362)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/ExpirationAlgorithm.java 2010-04-07
21:35:13 UTC (rev 8363)
@@ -195,7 +195,7 @@
break;
}
}
- if (max != 0 && set.size() > max )
+ if (max != -1 && set.size() > max )
log.warn("Unable to remove nodes to reduce region size below " +
config.getMaxNodes() + ". " +
"Set expiration for nodes in this region");
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithm.java 2010-04-07
21:15:40 UTC (rev 8362)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/FIFOAlgorithm.java 2010-04-07
21:35:13 UTC (rev 8363)
@@ -61,7 +61,7 @@
}
int size = this.getEvictionQueue().getNumberOfNodes();
- return config.getMaxNodes() != 0 && size > config.getMaxNodes();
+ return config.getMaxNodes() != -1 && size > config.getMaxNodes();
}
public Class<? extends EvictionAlgorithmConfig> getConfigurationClass()
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithm.java 2010-04-07
21:15:40 UTC (rev 8362)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LFUAlgorithm.java 2010-04-07
21:35:13 UTC (rev 8363)
@@ -36,7 +36,7 @@
* The minNodes property defines a threshold for eviction. If minNodes = 100,
* the LFUAlgorithm will not evict the cache to anything less than 100 elements
* still left in cache. The maxNodes property defines the maximum number of nodes
- * the cache will accept before eviction. maxNodes = 0 means that this region is
+ * the cache will accept before eviction. maxNodes = -1 means that this region is
* unbounded. minNodes = 0 means that the eviction queue will attempt to bring
* the cache of this region to 0 elements (evict all elements) whenever it is run.
* <p/>
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2010-04-07
21:15:40 UTC (rev 8362)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/LRUAlgorithm.java 2010-04-07
21:35:13 UTC (rev 8363)
@@ -180,7 +180,7 @@
}
int maxNodes = ((LRUAlgorithmConfig) evictionAlgorithmConfig).getMaxNodes();
- if (maxNodes <= 0)
+ if (maxNodes < 0)
{
return;
}
Modified: core/trunk/src/main/java/org/jboss/cache/eviction/MRUAlgorithm.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/eviction/MRUAlgorithm.java 2010-04-07
21:15:40 UTC (rev 8362)
+++ core/trunk/src/main/java/org/jboss/cache/eviction/MRUAlgorithm.java 2010-04-07
21:35:13 UTC (rev 8363)
@@ -50,7 +50,7 @@
if (isYoungerThanMinimumTimeToLive(ne)) return false;
MRUAlgorithmConfig config = (MRUAlgorithmConfig) evictionAlgorithmConfig;
- return evictionQueue.getNumberOfNodes() > config.getMaxNodes();
+ return config.getMaxNodes() > -1 && evictionQueue.getNumberOfNodes()
> config.getMaxNodes();
}
@Override