Author: shuber
Date: Thu Sep 27 15:51:00 2007
New Revision: 18696
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18696&repname=
=3Djahia
Log:
Refactoring to remove synchronization that was costly in terms of performan=
ce.
Modified:
branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/cache/Con=
tainerHTMLCache.java
Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/cac=
he/ContainerHTMLCache.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/services/cache/ContainerHTMLCache.java&rev=
=3D18696&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/cache/Con=
tainerHTMLCache.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/cache/Con=
tainerHTMLCache.java Thu Sep 27 15:51:00 2007
@@ -32,12 +32,26 @@
private static final String WORKFLOWSTATE_PREFIX =3D "WORKFLOWSTATE-";
private static final String SCHEME_PREFIX =3D "SCHEME-";
=
+ private SortedMap groups;
+ private SortedSet users;
+ =
/**
* <p>Creates a new <code>ContainerHTMLCache</code> instance.</p>
*
*/
protected ContainerHTMLCache(CacheImplementation cacheImplementation) {
super(CONTAINER_HTML_CACHE, cacheImplementation);
+
+ groups =3D new TreeMap();
+ Collection names =3D ServicesRegistry.getInstance().getJahiaACLMan=
agerService().getAllGroupsInAcl();
+ for (Iterator iterator =3D names.iterator(); iterator.hasNext();) {
+ String name =3D (String) iterator.next();
+ JahiaGroup g =3D ServicesRegistry.getInstance().getJahiaGroupM=
anagerService().lookupGroup(name);
+ groups.put(name,g);
+ }
+
+ users =3D new TreeSet(ServicesRegistry.getInstance().getJahiaACLMa=
nagerService().getAllUsersInAcl());
+
}
=
/**
@@ -137,6 +151,13 @@
}
}
users =3D new TreeSet(ServicesRegistry.getInstance().getJahiaACLMa=
nagerService().getAllUsersInAcl());
+ groups =3D new TreeMap();
+ Collection names =3D ServicesRegistry.getInstance().getJahiaACLMan=
agerService().getAllGroupsInAcl();
+ for (Iterator iterator =3D names.iterator(); iterator.hasNext();) {
+ String name =3D (String) iterator.next();
+ JahiaGroup g =3D ServicesRegistry.getInstance().getJahiaGroupM=
anagerService().lookupGroup(name);
+ groups.put(name,g);
+ }
}
=
public String getUserCacheKey(JahiaUser user, int siteID) {
@@ -161,26 +182,12 @@
return usercachekey;
}
=
- private SortedMap groups;
- private SortedSet users;
=
- private synchronized Collection getAllGroups() {
- if (groups =3D=3D null) {
- groups =3D new TreeMap();
- Collection names =3D ServicesRegistry.getInstance().getJahiaAC=
LManagerService().getAllGroupsInAcl();
- for (Iterator iterator =3D names.iterator(); iterator.hasNext(=
);) {
- String name =3D (String) iterator.next();
- JahiaGroup g =3D ServicesRegistry.getInstance().getJahiaGr=
oupManagerService().lookupGroup(name);
- groups.put(name,g);
- }
- }
+ private Collection getAllGroups() {
return groups.values();
}
=
- private synchronized Collection getAllUsers() {
- if (users =3D=3D null) {
- users =3D new TreeSet(ServicesRegistry.getInstance().getJahiaA=
CLManagerService().getAllUsersInAcl());
- }
+ private Collection getAllUsers() {
return users;
=
}
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list