svn commit: r585664 - in /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache: CacheLineTable.java UtilCache.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r585664 - in /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache: CacheLineTable.java UtilCache.java

doogie-3
Author: doogie
Date: Wed Oct 17 13:12:58 2007
New Revision: 585664

URL: http://svn.apache.org/viewvc?rev=585664&view=rev
Log:
CacheLineTable does not implement map; as such, there's no need to
return Object.  It's better to have it return CacheLine.  Closes
https://issues.apache.org/jira/browse/OFBIZ-1328

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/CacheLineTable.java
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/CacheLineTable.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/CacheLineTable.java?rev=585664&r1=585663&r2=585664&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/CacheLineTable.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/CacheLineTable.java Wed Oct 17 13:12:58 2007
@@ -83,15 +83,15 @@
         this.setLru(maxInMemory);
     }
 
-    public synchronized Object put(Object key, Object value) {
+    public synchronized CacheLine put(Object key, CacheLine value) {
         if (key == null) {
             if (Debug.verboseOn()) Debug.logVerbose("In CacheLineTable tried to put with null key, using NullObject" + this.cacheName, module);
             key = ObjectType.NULL;
         }
-        Object oldValue = memoryTable.put(key, value);
+        CacheLine oldValue = (CacheLine) memoryTable.put(key, value);
         if (fileTable != null) {
             try {
-                if (oldValue == null) oldValue = fileTable.get(key);
+                if (oldValue == null) oldValue = (CacheLine) fileTable.get(key);
                 fileTable.put(key, value);                
                 CacheLineTable.jdbmMgr.commit();
             } catch (IOException e) {
@@ -101,16 +101,16 @@
         return oldValue;
     }
 
-    public Object get(Object key) {
+    public CacheLine get(Object key) {
         if (key == null) {
             if (Debug.verboseOn()) Debug.logVerbose("In CacheLineTable tried to get with null key, using NullObject" + this.cacheName, module);
             key = ObjectType.NULL;
         }
-        Object value = memoryTable.get(key);
+        CacheLine value = (CacheLine) memoryTable.get(key);
         if (value == null) {
             if (fileTable != null) {
                 try {
-                    value = fileTable.get(key);
+                    value = (CacheLine) fileTable.get(key);
                 } catch (IOException e) {
                     Debug.logError(e, module);
                 }
@@ -119,12 +119,12 @@
         return value;
     }
 
-    public synchronized Object remove(Object key) {
+    public synchronized CacheLine remove(Object key) {
         if (key == null) {
             if (Debug.verboseOn()) Debug.logVerbose("In CacheLineTable tried to remove with null key, using NullObject" + this.cacheName, module);
             key = ObjectType.NULL;
         }
-        Object value = this.get(key);
+        CacheLine value = this.get(key);
         if (fileTable != null) {
             try {
                 fileTable.remove(key);

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java?rev=585664&r1=585663&r2=585664&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/UtilCache.java Wed Oct 17 13:12:58 2007
@@ -297,7 +297,7 @@
         } else {
             newCacheLine = useSoftReference ? new SoftRefCacheLine(value, expireTime) : new HardRefCacheLine(value, expireTime);
         }
-        oldCacheLine = (CacheLine) cacheLineTable.put(key, newCacheLine);
+        oldCacheLine = cacheLineTable.put(key, newCacheLine);
 
         if (oldCacheLine == null) {
             noteAddition(key, value);
@@ -328,7 +328,7 @@
             if (Debug.verboseOn()) Debug.logVerbose("In UtilCache tried to get with null key, using NullObject for cache " + this.getName(), module);
             key = ObjectType.NULL;
         }
-        CacheLine line = (CacheLine) cacheLineTable.get(key);
+        CacheLine line = cacheLineTable.get(key);
         return line;
     }
     
@@ -390,7 +390,7 @@
             if (Debug.verboseOn()) Debug.logVerbose("In UtilCache tried to remove with null key, using NullObject for cache " + this.getName(), module);
             key = ObjectType.NULL;
         }
-        CacheLine line = (CacheLine) cacheLineTable.remove(key);
+        CacheLine line = cacheLineTable.remove(key);
         if (line != null) {
             noteRemoval(key, line.getValue());
             if (countRemove) this.removeHitCount++;
@@ -534,7 +534,7 @@
             Iterator keys = cacheLineTable.keySet().iterator();
             while (keys.hasNext()) {
                 Object key = keys.next();
-                CacheLine line = (CacheLine) cacheLineTable.get(key);
+                CacheLine line = cacheLineTable.get(key);
                 if (useSoftReference) {
                     if (line instanceof SoftRefCacheLine) continue;
                     cacheLineTable.put(key, new SoftRefCacheLine(line.getValue(), line.loadTime, line.expireTime));