[jboss-cvs] JBossCache/src/org/jboss/cache ...
Brian Stansberry
brian.stansberry at jboss.com
Wed Nov 8 16:48:33 EST 2006
User: bstansberry
Date: 06/11/08 16:48:33
Modified: src/org/jboss/cache RegionImpl.java Region.java
Log:
Add unimplemented API for mark/unmarkNodeInUse
Revision Changes Path
1.6 +22 -0 JBossCache/src/org/jboss/cache/RegionImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RegionImpl.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/RegionImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- RegionImpl.java 13 Oct 2006 14:53:28 -0000 1.5
+++ RegionImpl.java 8 Nov 2006 21:48:33 -0000 1.6
@@ -6,7 +6,12 @@
*/
package org.jboss.cache;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.eviction.EvictedEventNode;
import org.jboss.cache.eviction.EvictionPolicyConfig;
+import org.jboss.cache.eviction.LRUPolicy;
+import org.jboss.cache.eviction.NodeEventType;
/**
* Default implementation of a {@link Region}
@@ -15,6 +20,8 @@
*/
public class RegionImpl implements Region
{
+ private static final Log log = LogFactory.getLog(RegionImpl.class);
+
RegionManager regionManager;
Fqn fqn;
boolean active;
@@ -78,6 +85,21 @@
return fqn;
}
+ public void markNodeCurrentlyInUse(Fqn fqn, long timeout)
+ {
+// EvictedEventNode markUse = new EvictedEventNode(fqn, NodeEventType.MARK_IN_USE_EVENT);
+// markUse.setInUseTimeout(timeout);
+// putNodeEvent(markUse);
+ log.error("markNodeCurrentlyInUse not yet implemented");
+ }
+
+ public void unmarkNodeCurrentlyInUse(Fqn fqn)
+ {
+// EvictedEventNode markNoUse = new EvictedEventNode(fqn, NodeEventType.UNMARK_USE_EVENT);
+// putNodeEvent(markNoUse);
+ log.error("markNodeCurrentlyInUse not yet implemented");
+ }
+
public String toString()
{
return "RegionImpl{" +
1.5 +27 -0 JBossCache/src/org/jboss/cache/Region.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Region.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Region.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Region.java 12 Oct 2006 23:03:57 -0000 1.4
+++ Region.java 8 Nov 2006 21:48:33 -0000 1.5
@@ -7,6 +7,8 @@
package org.jboss.cache;
import org.jboss.cache.eviction.EvictionPolicyConfig;
+import org.jboss.cache.eviction.EvictionPolicy;
+import org.jboss.cache.eviction.LRUPolicy;
/**
* Represents a section of the cache, and characteristics such as class loading and activaton can be applied to regions.
@@ -58,5 +60,30 @@
EvictionPolicyConfig getEvictionPolicyConfig();
+ /**
+ * Add an event to the eviction queue marking a node as currently in use.
+ * If there is an {@link EvictionPolicy} associated with this region, and
+ * it respects this event ({@link LRUPolicy} does), then the node will not
+ * be evicted until {@link #unmarkNodeCurrentlyInUse(Fqn)} is invoked.
+ * <p/>
+ * This mechanism can be used to prevent eviction of data that the application
+ * is currently using, in the absence of any locks on the node where the
+ * data is stored.
+ *
+ * @param fqn Fqn of the node.
+ *
+ * @see #unmarkNodeCurrentlyInUse(Fqn)
+ */
+ void markNodeCurrentlyInUse(Fqn fqn, long timeout);
+
+ /**
+ * Add an event to the eviction queue indicating that a node is no longer in use.
+ *
+ * @param fqn Fqn of the node.
+ *
+ * @see #markNodeCurrentlyInUse(Fqn, long)
+ */
+ void unmarkNodeCurrentlyInUse(Fqn fqn);
+
Fqn getFqn();
}
More information about the jboss-cvs-commits
mailing list