/** * Returns the roster for the given username. * * @param username the username to search for. * @return the roster associated with the ID. * @throws org.jivesoftware.openfire.user.UserNotFoundException if the ID does not correspond * to a known entity on the server. */ public Roster getRoster(String username) throws UserNotFoundException { Roster roster = rosterCache.get(username); if (roster == null) { // Synchronize using a unique key so that other threads loading the User // and not the Roster cannot produce a deadlock synchronized ((username + MUTEX_SUFFIX).intern()) { roster = rosterCache.get(username); if (roster == null) { // Not in cache so load a new one: roster = new Roster(username); rosterCache.put(username, roster); } } } return roster; }
/** * Returns the roster for the given username. * * @param username the username to search for. * @return the roster associated with the ID. * @throws org.jivesoftware.openfire.user.UserNotFoundException if the ID does not correspond * to a known entity on the server. */ public Roster getRoster(String username) throws UserNotFoundException { Roster roster = rosterCache.get(username); if (roster == null) { // Synchronize using a unique key so that other threads loading the User // and not the Roster cannot produce a deadlock synchronized ((username + " ro").intern()) { roster = rosterCache.get(username); if (roster == null) { // Not in cache so load a new one: roster = new Roster(username); rosterCache.put(username, roster); } } } return roster; }