Commit 38b65e99 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Syncronization. JM-605

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3622 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4c59778b
......@@ -210,6 +210,7 @@ public class GroupManager {
* @return an unmodifiable Collection of all groups.
*/
public Collection<Group> getGroups() {
synchronized (globalGroupKey) {
Collection<Group> groups = userGroupCache.get(globalGroupKey);
if (groups == null) {
groups = provider.getGroups();
......@@ -219,6 +220,7 @@ public class GroupManager {
}
return groups;
}
}
/**
* Returns an iterator for all groups according to a filter.
......@@ -258,15 +260,18 @@ public class GroupManager {
* @return all groups that an entity belongs to.
*/
public Collection<Group> getGroups(JID user) {
Collection<Group> groups = userGroupCache.get(user);
String userID = user.toString();
synchronized (userID.intern()) {
Collection<Group> groups = userGroupCache.get(userID);
if (groups == null) {
groups = provider.getGroups(user);
// Add to cache and ensure correct identity
groups = cacheAndEnsureIdentity(groups);
userGroupCache.put(user.toString(), groups);
userGroupCache.put(userID, groups);
}
return groups;
}
}
/**
* Returns the configured group provider. Note that this method has special access
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment