You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2005/06/29 09:14:20 UTC

svn commit: r202325 - /portals/jetspeed-2/trunk/components/profiler/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfilerImpl.java

Author: taylor
Date: Wed Jun 29 00:14:19 2005
New Revision: 202325

URL: http://svn.apache.org/viewcvs?rev=202325&view=rev
Log:
move back db performance optimization on retrieve rules for principals

Modified:
    portals/jetspeed-2/trunk/components/profiler/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfilerImpl.java

Modified: portals/jetspeed-2/trunk/components/profiler/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfilerImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/profiler/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfilerImpl.java?rev=202325&r1=202324&r2=202325&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/profiler/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfilerImpl.java (original)
+++ portals/jetspeed-2/trunk/components/profiler/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfilerImpl.java Wed Jun 29 00:14:19 2005
@@ -72,6 +72,7 @@
     private String defaultRule = "j1";
 
     private Map principalRules = new HashMap();
+    private Map rulesPerPrincipal = new HashMap();
 
     public JetspeedProfilerImpl(String repositoryPath)
     {
@@ -300,6 +301,7 @@
         pr.setProfilingRule(rule);
         getPersistenceBrokerTemplate().store(pr);
         principalRules.put(makePrincipalRuleKey(principal.getName(), locatorName), pr);
+        this.rulesPerPrincipal.remove(principal.getName());        
     }
 
     private String makePrincipalRuleKey( String principal, String locator )
@@ -394,7 +396,7 @@
             names[ix] = pr.getLocatorName();
             ix++;
         }
-        return names;
+        return names; 
     }
 
     /*
@@ -404,9 +406,14 @@
      */
     public Collection getRulesForPrincipal( Principal principal )
     {
+        Collection rules = (Collection)this.rulesPerPrincipal.get(principal.getName());
+        if (rules != null)
+            return rules;
         Criteria c = new Criteria();
         c.addEqualTo("principalName", principal.getName());
-        return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(principalRuleClass, c));
+        rules = getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(principalRuleClass, c));
+        this.rulesPerPrincipal.put(principal.getName(), rules);
+        return rules;
     }
 
     /*



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org