svn commit: r585801 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/ framework/entity/src/org/ofbiz/entity/cache/ framework/webtools/src/org/ofbiz/webtools/ framework/webtools/webapp/webtools/WEB-INF/actions/cache/ framework/widget/src/or...

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

svn commit: r585801 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/ framework/entity/src/org/ofbiz/entity/cache/ framework/webtools/src/org/ofbiz/webtools/ framework/webtools/webapp/webtools/WEB-INF/actions/cache/ framework/widget/src/or...

doogie-3
Author: doogie
Date: Wed Oct 17 19:41:30 2007
New Revision: 585801

URL: http://svn.apache.org/viewvc?rev=585801&view=rev
Log:
Make use of UtilCache.findCache.

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/editUtilCache.bsh
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCache.bsh
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCacheElements.bsh
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=585801&r1=585800&r2=585801&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java Wed Oct 17 19:41:30 2007
@@ -1210,13 +1210,13 @@
     public static Map clearContentAssocViewCache(DispatchContext dctx, Map context) throws GenericServiceException{
         Map results = new HashMap();
 
-        UtilCache utilCache = (UtilCache) UtilCache.utilCacheTable.get("entitycache.entity-list.default.ContentAssocViewFrom");
+        UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewFrom");
 
         if (utilCache != null) {
             utilCache.clear();
         }
         
-        utilCache = (UtilCache) UtilCache.utilCacheTable.get("entitycache.entity-list.default.ContentAssocViewTo");
+        utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewTo");
         if (utilCache != null) {
             utilCache.clear();
         }
@@ -1228,12 +1228,12 @@
     
         Map results = new HashMap();
 
-        UtilCache utilCache = (UtilCache) UtilCache.utilCacheTable.get("entitycache.entity-list.default.ContentAssocViewDataResourceFrom");
+        UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceFrom");
         if (utilCache != null) {
             utilCache.clear();
         }
         
-        utilCache = (UtilCache) UtilCache.utilCacheTable.get("entitycache.entity-list.default.ContentAssocViewDataResourceTo");
+        utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceTo");
         if (utilCache != null) {
             utilCache.clear();
         }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java?rev=585801&r1=585800&r2=585801&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java Wed Oct 17 19:41:30 2007
@@ -70,15 +70,13 @@
     }
 
     protected UtilCache getCache(String entityName) {
-        synchronized (UtilCache.utilCacheTable) {
-            return (UtilCache) UtilCache.utilCacheTable.get(getCacheName(entityName));
-        }
+        return UtilCache.findCache(getCacheName(entityName));
     }
 
     protected UtilCache getOrCreateCache(String entityName) {
         synchronized (UtilCache.utilCacheTable) {
             String name = getCacheName(entityName);
-            UtilCache cache = (UtilCache) UtilCache.utilCacheTable.get(name);
+            UtilCache cache = UtilCache.findCache(name);
             if (cache == null) {
                 cache = new UtilCache(name, 0, 0, true);
                 String[] names = getCacheNames(entityName);

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java?rev=585801&r1=585800&r2=585801&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java Wed Oct 17 19:41:30 2007
@@ -172,10 +172,7 @@
     }
 
     protected void storeHook(String entityName, boolean isPK, List oldValues, List newValues) {
-        UtilCache entityCache = null;
-        synchronized (UtilCache.utilCacheTable) {
-            entityCache = (UtilCache) UtilCache.utilCacheTable.get(getCacheName(entityName));
-        }
+        UtilCache entityCache = UtilCache.findCache(getCacheName(entityName));
         // for info about cache clearing
         if (newValues == null || newValues.size() == 0 || newValues.get(0) == null) {
             //Debug.logInfo("In storeHook (cache clear) for entity name [" + entityName + "], got entity cache with name: " + (entityCache == null ? "[No cache found to remove from]" : entityCache.getName()), module);

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=585801&r1=585800&r2=585801&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java Wed Oct 17 19:41:30 2007
@@ -74,7 +74,7 @@
             return "error";
         }
 
-        UtilCache utilCache = (UtilCache) UtilCache.utilCacheTable.get(name);
+        UtilCache utilCache = UtilCache.findCache(name);
 
         if (utilCache != null) {
             Object key = null;
@@ -139,7 +139,7 @@
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
-        UtilCache utilCache = (UtilCache) UtilCache.utilCacheTable.get(name);
+        UtilCache utilCache = UtilCache.findCache(name);
 
         if (utilCache != null) {
             utilCache.clear();
@@ -233,7 +233,7 @@
             expireTime = Long.valueOf(expireTimeStr);
         } catch (Exception e) {}
 
-        UtilCache utilCache = (UtilCache) UtilCache.utilCacheTable.get(name);
+        UtilCache utilCache = UtilCache.findCache(name);
 
         if (utilCache != null) {
             if (maxSize != null)

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/editUtilCache.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/editUtilCache.bsh?rev=585801&r1=585800&r2=585801&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/editUtilCache.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/editUtilCache.bsh Wed Oct 17 19:41:30 2007
@@ -25,7 +25,7 @@
 context.put("cacheName", cacheName);
 
 if (cacheName != null) {
-    UtilCache utilCache = (UtilCache)UtilCache.utilCacheTable.get(cacheName);
+    UtilCache utilCache = UtilCache.findCache(cacheName);
     if (utilCache != null) {
         Map cache = new HashMap();
         

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCache.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCache.bsh?rev=585801&r1=585800&r2=585801&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCache.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCache.bsh Wed Oct 17 19:41:30 2007
@@ -41,7 +41,7 @@
 if(nameIter != null && nameIter.hasNext()) {
     while(nameIter.hasNext()) {
         String cacheName = (String)nameIter.next();
-        UtilCache utilCache = (UtilCache)UtilCache.utilCacheTable.get(cacheName);
+        UtilCache utilCache = UtilCache.findCache(cacheName);
         Map cache = new HashMap();
         
         cache.put("cacheName", utilCache.getName());

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCacheElements.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCacheElements.bsh?rev=585801&r1=585800&r2=585801&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCacheElements.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCacheElements.bsh Wed Oct 17 19:41:30 2007
@@ -38,7 +38,7 @@
 
 List cacheElementsList = new ArrayList();
 if (cacheName != null) {
-    UtilCache utilCache = (UtilCache)UtilCache.utilCacheTable.get(cacheName);
+    UtilCache utilCache = UtilCache.findCache(cacheName);
     if (utilCache != null) {
         Iterator iter = utilCache.cacheLineTable.keySet().iterator();
         if(iter != null && iter.hasNext()) {

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java?rev=585801&r1=585800&r2=585801&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java Wed Oct 17 19:41:30 2007
@@ -45,15 +45,13 @@
     }
 
     protected UtilCache getCache(String widgetName) {
-        synchronized (UtilCache.utilCacheTable) {
-            return (UtilCache) UtilCache.utilCacheTable.get(getCacheName(widgetName));
-        }
+        return UtilCache.findCache(getCacheName(widgetName));
     }
 
     protected UtilCache getOrCreateCache(String widgetName) {
         synchronized (UtilCache.utilCacheTable) {
             String name = getCacheName(widgetName);
-            UtilCache cache = (UtilCache) UtilCache.utilCacheTable.get(name);
+            UtilCache cache = UtilCache.findCache(name);
             if (cache == null) {
                 cache = new UtilCache(name, 0, 0, true);
                 cache.setPropertiesParams(new String[] {name});