Commit 787a8023 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Fixed concurrency problem.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@748 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1213aab0
......@@ -38,7 +38,7 @@ public class UserManager {
CacheManager.initializeCache("userCache", 512 * 1024);
CacheManager.initializeCache("username2roster", 512 * 1024);
userCache = CacheManager.getCache("userCache");
// Load a group provider.
// Load a user provider.
String className = JiveGlobals.getXMLProperty("provider.user.className",
"org.jivesoftware.messenger.user.DefaultUserProvider");
try {
......@@ -130,10 +130,15 @@ public class UserManager {
catch (StringprepException se) {
throw new IllegalArgumentException(se);
}
User user = (User)userCache.get(username);
User user = (User) userCache.get(username);
if (user == null) {
user = provider.loadUser(username);
userCache.put(username, user);
synchronized(username.intern()) {
user = (User) userCache.get(username);
if (user == null) {
user = provider.loadUser(username);
userCache.put(username, user);
}
}
}
return user;
}
......
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