Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4202)

Unified Diff: bundles/memory/src/main/java/org/sakaiproject/nakamura/memory/MapCacheImpl.java

Issue 5350045: OAE 1.0 Clustering Part I of N
Patch Set: Created 12 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: bundles/memory/src/main/java/org/sakaiproject/nakamura/memory/MapCacheImpl.java
diff --git a/bundles/memory/src/main/java/org/sakaiproject/nakamura/memory/MapCacheImpl.java b/bundles/memory/src/main/java/org/sakaiproject/nakamura/memory/MapCacheImpl.java
index e296430ec54d2ff78114fae15225e02c6d27dc47..f09ad7cb6191f63a44d470f11b3904a5160b341e 100644
--- a/bundles/memory/src/main/java/org/sakaiproject/nakamura/memory/MapCacheImpl.java
+++ b/bundles/memory/src/main/java/org/sakaiproject/nakamura/memory/MapCacheImpl.java
@@ -18,6 +18,7 @@
package org.sakaiproject.nakamura.memory;
import org.sakaiproject.nakamura.api.memory.Cache;
+import org.sakaiproject.nakamura.api.memory.CacheScope;
import org.sakaiproject.nakamura.api.memory.ThreadBound;
import java.util.ArrayList;
@@ -35,8 +36,15 @@ public class MapCacheImpl<V> extends HashMap<String, V>implements Cache<V> {
*
*/
private static final long serialVersionUID = -5400056532743570231L;
+ private CacheScope scope;
+ private String name;
- /**
+ public MapCacheImpl(String name, CacheScope scope) {
+ this.scope = scope;
+ this.name = name;
+ }
+
+/**
* {@inheritDoc}
* @see org.sakaiproject.nakamura.api.memory.Cache#containsKey(java.lang.String)
*/
@@ -104,6 +112,13 @@ public class MapCacheImpl<V> extends HashMap<String, V>implements Cache<V> {
return new ArrayList<V>(super.values());
}
+ public void checkCompatableScope(CacheScope scope) {
+ if (!scope.equals(this.scope)) {
+ throw new IllegalStateException("The cache called " + name
+ + " is a " + this.scope
+ + " cache and cant be re-used as a " + scope + " cache");
+ }
+ }

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b