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

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

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

doogie-3
Author: doogie
Date: Thu Apr  1 05:21:21 2010
New Revision: 929847

URL: http://svn.apache.org/viewvc?rev=929847&view=rev
Log:
Fix for buildbot failure, due to committing untested rebased code;
mea-culpa.

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

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java?rev=929847&r1=929846&r2=929847&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java Thu Apr  1 05:21:21 2010
@@ -130,6 +130,14 @@ public final class ExecutionPool {
             expireTimeNanos = loadTimeNanos + delayNanos;
         }
 
+        public long getLoadTimeNanos() {
+            return loadTimeNanos;
+        }
+
+        public long getExpireTimeNanos() {
+            return expireTimeNanos;
+        }
+
         public final long getDelay(TimeUnit unit) {
             return unit.convert(expireTimeNanos - System.nanoTime(), TimeUnit.NANOSECONDS);
         }

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=929847&r1=929846&r2=929847&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 Thu Apr  1 05:21:21 2010
@@ -834,10 +834,19 @@ public class UtilCache<K, V> implements
     private Map<String, Object> createLineInfo(int keyNum, K key, CacheLine<V> line) {
         Map<String, Object> lineInfo = FastMap.newInstance();
         lineInfo.put("elementKey", key);
-        if (line.loadTime > 0) {
-            lineInfo.put("expireTime", new Date(line.loadTime + line.expireTime));
+
+        if (line.getLoadTimeNanos() > 0) {
+            lineInfo.put("expireTimeMillis", TimeUnit.MILLISECONDS.convert(line.getExpireTimeNanos() - System.nanoTime(), TimeUnit.NANOSECONDS));
         }
-        lineInfo.put("lineSize", line.getSizeInBytes());
+        lineInfo.put("lineSize", findSizeInBytes(line.getValue()));
+        lineInfo.put("keyNum", keyNum);
+        return lineInfo;
+    }
+
+    private Map<String, Object> createLineInfo(int keyNum, K key, V value) {
+        Map<String, Object> lineInfo = FastMap.newInstance();
+        lineInfo.put("elementKey", key);
+        lineInfo.put("lineSize", findSizeInBytes(value));
         lineInfo.put("keyNum", keyNum);
         return lineInfo;
     }
@@ -847,19 +856,17 @@ public class UtilCache<K, V> implements
         int keyIndex = 0;
         for (K key: getCacheLineKeys()) {
             Object nulledKey = fromKey(key);
-            CacheLine<V> line;
             if (fileTable != null) {
                 try {
-                    line = fileTable.get(nulledKey);
+                    lineInfos.add(createLineInfo(keyIndex, key, fileTable.get(nulledKey)));
                 } catch (IOException e) {
                     Debug.logError(e, module);
-                    line = null;
                 }
             } else {
-                line = memoryTable.get(nulledKey);
-            }
-            if (line != null) {
-                lineInfos.add(createLineInfo(keyIndex, key, line));
+                CacheLine<V> line = memoryTable.get(nulledKey);
+                if (line != null) {
+                    lineInfos.add(createLineInfo(keyIndex, key, line));
+                }
             }
             keyIndex++;
         }

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=929847&r1=929846&r2=929847&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 Thu Apr  1 05:21:21 2010
@@ -35,8 +35,8 @@ if (cacheName) {
     if (utilCache) {
         cacheElementsList = utilCache.getLineInfos()
         cacheElementsList.each {
-            if (it.expireTime != null) {
-                it.expireTime = it.expireTime.toString();
+            if (it.expireTimeMillis != null) {
+                it.expireTimeMillis = it.expireTimeMillis / 1000 .toString();
             }
             totalSize += it.lineSize;
             it.lineSize = UtilFormatOut.formatQuantity(it.lineSize);