Commit 1f189fd6 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Code cleanup, removed synchronization.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@680 b35dd754-fafc-0310-a699-88a17e54d16e
parent ff49ae5f
...@@ -25,6 +25,7 @@ import java.util.Map; ...@@ -25,6 +25,7 @@ import java.util.Map;
* @author Iain Shigeoka * @author Iain Shigeoka
*/ */
abstract public class BasicConnection implements Connection { abstract public class BasicConnection implements Connection {
private Map listeners = new HashMap(); private Map listeners = new HashMap();
public void init(Session session) { public void init(Session session) {
......
...@@ -210,29 +210,21 @@ public class PresenceManagerImpl extends BasicModule implements PresenceManager ...@@ -210,29 +210,21 @@ public class PresenceManagerImpl extends BasicModule implements PresenceManager
} }
if (user != null) { if (user != null) {
synchronized (onlineUsers) {
onlineUsers.put(user.getUsername(), presence); onlineUsers.put(user.getUsername(), presence);
} }
}
else { else {
synchronized (onlineGuests) {
onlineGuests.put(presence.getID(), presence); onlineGuests.put(presence.getID(), presence);
} }
} }
}
public void setOffline(Presence presence) { public void setOffline(Presence presence) {
if (presence.getFrom().getNode() != null) { if (presence.getFrom().getNode() != null) {
synchronized (onlineUsers) {
onlineUsers.remove(presence.getFrom().getNode()); onlineUsers.remove(presence.getFrom().getNode());
} }
}
else { else {
synchronized (onlineGuests) {
onlineGuests.remove(presence.getID()); onlineGuests.remove(presence.getID());
} }
} }
}
public void setOffline(JID jid) throws UnauthorizedException { public void setOffline(JID jid) throws UnauthorizedException {
} }
......
...@@ -197,15 +197,14 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster { ...@@ -197,15 +197,14 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster {
} }
} }
public synchronized RosterItem deleteRosterItem(JID user) throws UnauthorizedException { public RosterItem deleteRosterItem(JID user) throws UnauthorizedException {
// Note that the super cache will always only hold cached roster items // Note that the super cache will always only hold cached roster items
CachedRosterItem item = (CachedRosterItem)super.deleteRosterItem(user); CachedRosterItem item = (CachedRosterItem)super.deleteRosterItem(user);
if (item != null) { if (item != null) {
// If removing the user was successful, remove the user from the backend store // If removing the user was successful, remove the user from the backend store
rosterItemProvider.deleteItem(username, item.getID()); rosterItemProvider.deleteItem(username, item.getID());
// broadcast the update to the user // Broadcast the update to the user
Roster roster = new Roster(); Roster roster = new Roster();
roster.setType(IQ.Type.set); roster.setType(IQ.Type.set);
roster.addItem(user, Roster.Subscription.remove); roster.addItem(user, Roster.Subscription.remove);
...@@ -214,8 +213,6 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster { ...@@ -214,8 +213,6 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster {
return item; return item;
} }
private void broadcast(Roster roster) throws UnauthorizedException { private void broadcast(Roster roster) throws UnauthorizedException {
if (server == null) { if (server == null) {
server = BasicServer.getInstance(); server = BasicServer.getInstance();
......
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