[jboss-cvs] JBossCache/src/org/jboss/cache/eviction ...
Manik Surtani
msurtani at jboss.com
Wed Nov 15 12:01:30 EST 2006
User: msurtani
Date: 06/11/15 12:01:30
Modified: src/org/jboss/cache/eviction EvictionTimerTask.java
MRUQueue.java
Log:
Fixed eviction breakages
Revision Changes Path
1.8 +11 -5 JBossCache/src/org/jboss/cache/eviction/EvictionTimerTask.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EvictionTimerTask.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/eviction/EvictionTimerTask.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- EvictionTimerTask.java 15 Nov 2006 16:30:39 -0000 1.7
+++ EvictionTimerTask.java 15 Nov 2006 17:01:29 -0000 1.8
@@ -9,30 +9,30 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Region;
import org.jboss.cache.AbstractCacheListener;
import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Region;
import org.jboss.cache.notifications.Notifier;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import java.util.TimerTask;
import java.util.Timer;
+import java.util.TimerTask;
/**
* Timer threads to do periodic node clean up by running the eviction policy.
*
* @author Ben Wang 2-2004
* @author Daniel Huang (dhuang at jboss.org)
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class EvictionTimerTask extends TimerTask
{
private Log log = LogFactory.getLog(EvictionTimerTask.class);
- private final Set processedRegions;
+ private final Set<Region> processedRegions;
private int wakeupIntervalSeconds;
@@ -40,7 +40,7 @@
{
// synchronized set because we need to maintain thread safety
// for dynamic configuration purposes.
- processedRegions = Collections.synchronizedSet(new HashSet());
+ processedRegions = Collections.synchronizedSet(new HashSet<Region>());
}
public void init(int wakeupIntervalSeconds, Notifier notifier)
@@ -106,6 +106,11 @@
}
}
+ public boolean isRegionRegisteredForProcessing(Region region)
+ {
+ return processedRegions.contains(region);
+ }
+
class EvictionListener extends AbstractCacheListener
{
private Log log = LogFactory.getLog(EvictionListener.class);
@@ -114,6 +119,7 @@
public void cacheStarted(CacheSPI cache)
{
log.debug("Starting eviction timer");
+ if (evictionThread != null) evictionThread.cancel();
evictionThread = new Timer();
evictionThread.schedule(EvictionTimerTask.this,
wakeupIntervalSeconds * 1000,
1.7 +6 -1 JBossCache/src/org/jboss/cache/eviction/MRUQueue.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MRUQueue.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/eviction/MRUQueue.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- MRUQueue.java 8 Jun 2006 17:37:39 -0000 1.6
+++ MRUQueue.java 15 Nov 2006 17:01:30 -0000 1.7
@@ -22,7 +22,7 @@
* a node that is used to the top of the eviction stack.
*
* @author Daniel Huang (dhuang at jboss.org)
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public class MRUQueue implements EvictionQueue
{
@@ -145,4 +145,9 @@
{
return list.iterator();
}
+
+ public String toString()
+ {
+ return list.toString();
+ }
}
More information about the jboss-cvs-commits
mailing list