You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2008/06/30 15:09:41 UTC
svn commit: r672757 -
/forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java
Author: thorsten
Date: Mon Jun 30 06:09:41 2008
New Revision: 672757
URL: http://svn.apache.org/viewvc?rev=672757&view=rev
Log:
Enhancing lookup of locations. If cached result has null location we will try to resolve it again.
Modified:
forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java
Modified: forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java
URL: http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java?rev=672757&r1=672756&r2=672757&view=diff
==============================================================================
--- forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java (original)
+++ forrest/trunk/main/java/org/apache/forrest/locationmap/LocationMapModule.java Mon Jun 30 06:09:41 2008
@@ -208,23 +208,18 @@
}
hasBeenCached = m_locationsCache.containsKey(name);
- if (hasBeenCached == true) {
+ if (hasBeenCached == true && m_locationsCache.get(name)!=null) {
result = m_locationsCache.get(name);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Locationmap cached location returned for hint: " + name + " value: " + result);
}
- }
+ }else{
+ result = getFreshResult(name, objectModel);
+ }
}
if (hasBeenCached == false) {
- result = getLocationMap().locate(name,objectModel);
-
- if (m_cacheAll == true) {
- m_locationsCache.put(name,result);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Locationmap caching hint: " + name + " value: " + result);
- }
- }
+ result = getFreshResult(name, objectModel);
}
if (result == null) {
@@ -243,6 +238,20 @@
return null;
}
+ private Object getFreshResult(final String name, final Map objectModel)
+ throws Exception {
+ Object result;
+ result = getLocationMap().locate(name,objectModel);
+
+ if (m_cacheAll == true) {
+ m_locationsCache.put(name,result);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Locationmap caching hint: " + name + " value: " + result);
+ }
+ }
+ return result;
+ }
+
/**
* The possibilities are endless. No way to enumerate them all.
* Therefore returns null.