[jboss-svn-commits] JBL Code SVN: r25771 - labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Mar 20 13:03:07 EDT 2009
Author: lkrzyzanek
Date: 2009-03-20 13:03:07 -0400 (Fri, 20 Mar 2009)
New Revision: 25771
Modified:
labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManager.java
Log:
changed getHfURLTitle - when object is not in cache then find also records with duplicate hf urls
Modified: labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManager.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManager.java 2009-03-20 16:25:18 UTC (rev 25770)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-hfurl/src/main/java/org/jboss/labs/clearspace/plugin/hfurl/DbHFURLManager.java 2009-03-20 17:03:07 UTC (rev 25771)
@@ -98,12 +98,27 @@
hfURLCache.clear();
}
- public String getHfURLTitle(String documentID) throws EmptyResultDataAccessException {
+ public String getHfURLTitle(String documentID)
+ throws EmptyResultDataAccessException {
String hfURLTitle = hfURLCache.get(documentID);
+
if (hfURLTitle == null) {
HFURLBean bean = hfURLDAO.getByDocumentId(documentID);
hfURLTitle = bean.getHfTitle();
- hfURLCache.put(documentID, hfURLTitle);
+
+ // Don't put this object to cache by simple cache.put ... because it's not
+ // sure if there are some other objects with same hf title in DB.
+ // We must ensure that in cache will be always all records of duplicate HF
+ // URL docs, then mapping from HF URL to ID from cache will be consistent.
+
+ try {
+ List<HFURLBean> beans = hfURLDAO.getByHfURLTitle(hfURLTitle);
+ for (HFURLBean dbbean : beans) {
+ hfURLCache.put(dbbean.getDocumentID(), hfURLTitle);
+ }
+ } catch (EmptyResultDataAccessException e) {
+ // nothing founded - should not occur
+ }
}
return hfURLTitle;
}
More information about the jboss-svn-commits
mailing list