[hibernate-commits] Hibernate SVN: r15312 - core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Oct 9 15:28:17 EDT 2008


Author: cbredesen
Date: 2008-10-09 15:28:17 -0400 (Thu, 09 Oct 2008)
New Revision: 15312

Modified:
   core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util/SimpleMRUCache.java
   core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util/SoftLimitMRUCache.java
Log:
HHH-1486

Modified: core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util/SimpleMRUCache.java
===================================================================
--- core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util/SimpleMRUCache.java	2008-10-09 19:27:24 UTC (rev 15311)
+++ core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util/SimpleMRUCache.java	2008-10-09 19:28:17 UTC (rev 15312)
@@ -4,7 +4,6 @@
 
 import java.io.Serializable;
 import java.io.IOException;
-import java.util.Iterator;
 
 /**
  * Cache following a "Most Recently Used" (MRU) algorithm for maintaining a
@@ -36,15 +35,11 @@
 		return cache.get( key );
 	}
 
-	public Object put(Object key, Object value) {
+	public synchronized Object put(Object key, Object value) {
 		return cache.put( key, value );
 	}
 
-	public Iterator entries() {
-		return cache.entrySet().iterator();
-	}
-
-	public int size() {
+	public synchronized int size() {
 		return cache.size();
 	}
 
@@ -56,4 +51,8 @@
 		in.defaultReadObject();
 		init();
 	}
+
+	public synchronized void clear() {
+		cache.clear();
+	}
 }

Modified: core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util/SoftLimitMRUCache.java
===================================================================
--- core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util/SoftLimitMRUCache.java	2008-10-09 19:27:24 UTC (rev 15311)
+++ core/patches/v312_HHH-1486_HHH-2397/src/org/hibernate/util/SoftLimitMRUCache.java	2008-10-09 19:28:17 UTC (rev 15312)
@@ -5,7 +5,6 @@
 
 import java.io.Serializable;
 import java.io.IOException;
-import java.util.Iterator;
 
 /**
  * Cache following a "Most Recently Used" (MRY) algorithm for maintaining a
@@ -55,27 +54,19 @@
 		return result;
 	}
 
-	public Object put(Object key, Object value) {
+	public synchronized Object put(Object key, Object value) {
 		softReferenceCache.put( key, value );
 		return strongReferenceCache.put( key, value );
 	}
 
-	public int size() {
+	public synchronized int size() {
 		return strongReferenceCache.size();
 	}
 
-	public int softSize() {
+	public synchronized int softSize() {
 		return softReferenceCache.size();
 	}
 
-	public Iterator entries() {
-		return strongReferenceCache.entrySet().iterator();
-	}
-
-	public Iterator softEntries() {
-		return softReferenceCache.entrySet().iterator();
-	}
-
 	private void init() {
 		strongReferenceCache = new LRUMap( strongReferenceCount );
 	}
@@ -84,4 +75,9 @@
 		in.defaultReadObject();
 		init();
 	}
+
+	public synchronized void clear() {
+		strongReferenceCache.clear();
+		softReferenceCache.clear();
+	}
 }




More information about the hibernate-commits mailing list