You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2015/05/19 18:05:13 UTC
svn commit: r1680329 -
/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/MenuFactory.java
Author: adrianc
Date: Tue May 19 16:05:13 2015
New Revision: 1680329
URL: http://svn.apache.org/r1680329
Log:
Remove DCL pattern from MenuFactory.java.
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/MenuFactory.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/MenuFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/MenuFactory.java?rev=1680329&r1=1680328&r2=1680329&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/MenuFactory.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/MenuFactory.java Tue May 19 16:05:13 2015
@@ -54,17 +54,13 @@ public class MenuFactory {
Map<String, ModelMenu> modelMenuMap = menuWebappCache.get(cacheKey);
if (modelMenuMap == null) {
- synchronized (MenuFactory.class) {
- modelMenuMap = menuWebappCache.get(cacheKey);
- if (modelMenuMap == null) {
- ServletContext servletContext = (ServletContext) request.getAttribute("servletContext");
-
- URL menuFileUrl = servletContext.getResource(resourceName);
- Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true, true);
- modelMenuMap = readMenuDocument(menuFileDoc, cacheKey);
- menuWebappCache.put(cacheKey, modelMenuMap);
- }
- }
+ ServletContext servletContext = (ServletContext) request.getAttribute("servletContext");
+
+ URL menuFileUrl = servletContext.getResource(resourceName);
+ Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true, true);
+ modelMenuMap = readMenuDocument(menuFileDoc, cacheKey);
+ menuWebappCache.putIfAbsent(cacheKey, modelMenuMap);
+ modelMenuMap = menuWebappCache.get(cacheKey);
}
if (UtilValidate.isEmpty(modelMenuMap)) {
@@ -94,15 +90,11 @@ public class MenuFactory {
public static ModelMenu getMenuFromLocation(String resourceName, String menuName) throws IOException, SAXException, ParserConfigurationException {
Map<String, ModelMenu> modelMenuMap = menuLocationCache.get(resourceName);
if (modelMenuMap == null) {
- synchronized (MenuFactory.class) {
- modelMenuMap = menuLocationCache.get(resourceName);
- if (modelMenuMap == null) {
- URL menuFileUrl = FlexibleLocation.resolveLocation(resourceName);
- Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true, true);
- modelMenuMap = readMenuDocument(menuFileDoc, resourceName);
- menuLocationCache.put(resourceName, modelMenuMap);
- }
- }
+ URL menuFileUrl = FlexibleLocation.resolveLocation(resourceName);
+ Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true, true);
+ modelMenuMap = readMenuDocument(menuFileDoc, resourceName);
+ menuLocationCache.putIfAbsent(resourceName, modelMenuMap);
+ modelMenuMap = menuLocationCache.get(resourceName);
}
if (UtilValidate.isEmpty(modelMenuMap)) {