You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/11/29 22:25:17 UTC

svn commit: r885274 - in /ofbiz/trunk/framework: base/src/org/ofbiz/base/util/cache/UtilCache.java webtools/src/org/ofbiz/webtools/UtilCacheEvents.java webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy

Author: doogie
Date: Sun Nov 29 21:25:17 2009
New Revision: 885274

URL: http://svn.apache.org/viewvc?rev=885274&view=rev
Log:
Make cacheLineTable private and final.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=885274&r1=885273&r2=885274&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Sun Nov 29 21:25:17 2009
@@ -64,7 +64,7 @@
     private final String name;
 
     /** A hashtable containing a CacheLine object with a value and a loadTime for each element. */
-    public CacheLineTable<K, V> cacheLineTable = null;
+    private final CacheLineTable<K, V> cacheLineTable;
 
     /** A count of the number of cache hits */
     protected AtomicLong hitCount = new AtomicLong(0);
@@ -214,6 +214,10 @@
         }
     }
 
+    public CacheLineTable<K, V> getCacheLineTable() {
+        return cacheLineTable;
+    }
+
     public boolean isEmpty() {
         return cacheLineTable.isEmpty();
     }
@@ -291,7 +295,7 @@
     }
 
     public Collection<V> values() {
-        if (cacheLineTable == null) {
+        if (cacheLineTable.isEmpty()) {
             return Collections.emptyList();
         }
 

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java?rev=885274&r1=885273&r2=885274&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java Sun Nov 29 21:25:17 2009
@@ -81,11 +81,11 @@
 
             if (utilCache.getMaxSize() > 0) {
                 try {
-                    key = utilCache.cacheLineTable.getKeyFromMemory(number);
+                    key = utilCache.getCacheLineTable().getKeyFromMemory(number);
                 } catch (Exception e) {}
             } else {
                 // no LRU, try looping through the keySet to see if we find the specified index...
-                Iterator<?> ksIter = utilCache.cacheLineTable.keySet().iterator();
+                Iterator<?> ksIter = utilCache.getCacheLineTable().keySet().iterator();
                 int curNum = 0;
 
                 while (ksIter.hasNext()) {

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy?rev=885274&r1=885273&r2=885274&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy Sun Nov 29 21:25:17 2009
@@ -34,9 +34,9 @@
     utilCache = UtilCache.findCache(cacheName);
     if (utilCache) {
         int keyNum = 0;
-        utilCache.cacheLineTable.keySet().each { key ->
+        utilCache.getCacheLineTable().keySet().each { key ->
             cacheElement = [:];
-            line = utilCache.cacheLineTable.get(key);
+            line = utilCache.getCacheLineTable().get(key);
             expireTime = "";
             if (line?.loadTime > 0) {
                 expireTime = (new Date(line.loadTime + utilCache.getExpireTime())).toString();