From f0b3ba7634f646ea928e8186100beb9a68d38ab4 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Fri, 10 Feb 2017 20:38:46 +0000 Subject: [PATCH] Fixed: Reinstate url cache in UtilURL.fromResource (OFBIZ-9208) Adrian created the following commit to cache URL objects Revision: 1649979 Author: adrianc Date: 07 January 2015 00:24:28 Message: Some optimizations for URL lookups. ---- Modified : /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Modified : /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilURL.java and was later reverted in this commit Revision: 1650347 Author: adrianc Date: 08 January 2015 17:53:59 Message: Some small fixups for some of my previous commits. ---- Modified : /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityClassLoader.java Modified : /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilURL.java We have found in one of our production servers that line 98 in UtilURL.java url = loader.getResource(resourceName); has caused locking and looking at the stack trace (from jstack). There are numerous threads waiting on locks from within this method I propose the cache gets added back (we have done this as a patch on our systems with no ill effect) FYI - The commits are in reference to the EntityClassLoader which is not used and does not work see OFBIZ-6210 Thanks: Gareth Carter for report and suggestion git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1782520 13f79535-47bb-0310-9956-ffa450edef68 --- .../base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java index 6e2ee9bc79..d114bf627d 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java @@ -97,8 +97,7 @@ public final class UtilURL { } url = loader.getResource(resourceName); if (url != null) { - // Do not cache URLs from ClassLoader - interferes with EntityClassLoader operation - //urlMap.put(resourceName, url); + urlMap.put(resourceName, url); return url; } url = ClassLoader.getSystemResource(resourceName);