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

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

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

doogie-3
Author: doogie
Date: Thu Apr  1 04:30:02 2010
New Revision: 929811

URL: http://svn.apache.org/viewvc?rev=929811&view=rev
Log:
Make use of the new generics support in jdbm.

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

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java?rev=929811&r1=929810&r2=929811&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java Thu Apr  1 04:30:02 2010
@@ -48,7 +48,7 @@ public class CacheLineTable<K, V> implem
     public static final String module = CacheLineTable.class.getName();
     protected static transient RecordManager jdbmMgr = null;
 
-    protected transient HTree fileTable = null;
+    protected transient HTree<Object, CacheLine<V>> fileTable = null;
     protected Map<K, CacheLine<V>> memoryTable = null;
     protected String fileStore = null;
     protected String cacheName = null;
@@ -93,24 +93,18 @@ public class CacheLineTable<K, V> implem
     }
 
     @SuppressWarnings("unchecked")
-    private CacheLine<V> getFileTable(Object key) throws IOException {
-        return (CacheLine<V>) fileTable.get(key);
-    }
-
-
-    @SuppressWarnings("unchecked")
     private void addAllFileTableValues(List<CacheLine<V>> values) throws IOException {
-        FastIterator iter = fileTable.values();
-        Object value = iter.next();
+        FastIterator<CacheLine<V>> iter = fileTable.values();
+        CacheLine<V> value = iter.next();
         while (value != null) {
-            values.add((CacheLine<V>) value);
+            values.add(value);
             value = iter.next();
         }
     }
 
     @SuppressWarnings("unchecked")
     private void addAllFileTableKeys(Set<K> keys) throws IOException {
-        FastIterator iter = fileTable.keys();
+        FastIterator<Object> iter = fileTable.keys();
         Object key = null;
         while ((key = iter.next()) != null) {
             if (key instanceof ObjectType.NullObject) {
@@ -137,7 +131,7 @@ public class CacheLineTable<K, V> implem
         }
         if (fileTable != null) {
             try {
-                if (oldValue == null) oldValue = getFileTable(key != null ? key : ObjectType.NULL);
+                if (oldValue == null) oldValue = fileTable.get(key != null ? key : ObjectType.NULL);
                 fileTable.put(key != null ? key : ObjectType.NULL, value);
                 CacheLineTable.jdbmMgr.commit();
             } catch (IOException e) {
@@ -168,7 +162,7 @@ public class CacheLineTable<K, V> implem
         if (value == null) {
             if (fileTable != null) {
                 try {
-                    value = getFileTable(key != null ? key : ObjectType.NULL);
+                    value = fileTable.get(key != null ? key : ObjectType.NULL);
                 } catch (IOException e) {
                     Debug.logError(e, module);
                 }
@@ -226,10 +220,10 @@ public class CacheLineTable<K, V> implem
         List<Map.Entry<K, ? extends CacheLine<V>>> list = FastList.newInstance();
         if (fileTable != null) {
             try {
-                FastIterator iter = fileTable.keys();
+                FastIterator<Object> iter = fileTable.keys();
                 Object key = iter.next();
                 while (key != null) {
-                    CacheLine<V> value = UtilGenerics.cast(fileTable.get(key));
+                    CacheLine<V> value = fileTable.get(key);
                     if (key instanceof ObjectType.NullObject) {
                         key = null;
                     }