Commit 641cdac9 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

More cluster cache work. We are now locking not only the same cache but the same entry.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches@10076 b35dd754-fafc-0310-a699-88a17e54d16e
parent 48238d0e
......@@ -591,7 +591,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener
* the session unavailable means that the session is not eligible for receiving messages from
* other clients.
*
* @param session the session that receieved an unavailable presence.
* @param session the session that received an unavailable presence.
*/
public void sessionUnavailable(LocalClientSession session) {
if (session.getAddress() != null && routingTable != null &&
......
......@@ -323,7 +323,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
* @param name the discovered name of the component.
*/
public void addComponentItem(String jid, String node, String name) {
Lock lock = CacheFactory.getLock(jid + "item", serverItems);
Lock lock = CacheFactory.getLock(jid, serverItems);
try {
lock.lock();
ClusteredServerItem item = serverItems.get(jid);
......@@ -359,7 +359,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
// Safety check
return;
}
Lock lock = CacheFactory.getLock(jid + "item", serverItems);
Lock lock = CacheFactory.getLock(jid, serverItems);
try {
lock.lock();
ClusteredServerItem item = serverItems.get(jid);
......@@ -425,7 +425,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
NodeID leftNode = NodeID.getInstance(nodeID);
for (Map.Entry<String, ClusteredServerItem> entry : serverItems.entrySet()) {
String jid = entry.getKey();
Lock lock = CacheFactory.getLock(jid + "item", serverItems);
Lock lock = CacheFactory.getLock(jid, serverItems);
try {
lock.lock();
ClusteredServerItem item = entry.getValue();
......@@ -453,7 +453,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
for (Map.Entry<String, Element> entry : localServerItems.entrySet()) {
String jid = entry.getKey();
Element element = entry.getValue();
Lock lock = CacheFactory.getLock(jid + "item", serverItems);
Lock lock = CacheFactory.getLock(jid, serverItems);
try {
lock.lock();
ClusteredServerItem item = serverItems.get(jid);
......
......@@ -207,7 +207,7 @@ public class OutgoingSessionPromise implements RoutableChannelHandler {
// Create a connection to the remote server from the domain where the packet has been sent
boolean created;
// Make sure that only one cluster node is creating the outgoing connection
Lock lock = CacheFactory.getLock(domain + "oss", serversCache);
Lock lock = CacheFactory.getLock(domain, serversCache);
try {
lock.lock();
created = LocalOutgoingServerSession
......
......@@ -502,7 +502,7 @@ public class PresenceManagerImpl extends BasicModule implements PresenceManager
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
Lock lock = CacheFactory.getLock(username + "pr", offlinePresenceCache);
Lock lock = CacheFactory.getLock(username, offlinePresenceCache);
try {
lock.lock();
if (!offlinePresenceCache.containsKey(username) || !lastActivityCache.containsKey(username)) {
......
......@@ -108,7 +108,7 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust
public void addComponentRoute(JID route, RoutableChannelHandler destination) {
String address = route.getDomain();
localRoutingTable.addRoute(address, destination);
Lock lock = CacheFactory.getLock(address + "rt", componentsCache);
Lock lock = CacheFactory.getLock(address, componentsCache);
try {
lock.lock();
Set<NodeID> nodes = componentsCache.get(address);
......@@ -663,7 +663,7 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust
public boolean removeComponentRoute(JID route) {
String address = route.getDomain();
boolean removed = false;
Lock lock = CacheFactory.getLock(address + "rt", componentsCache);
Lock lock = CacheFactory.getLock(address, componentsCache);
try {
lock.lock();
Set<NodeID> nodes = componentsCache.get(address);
......
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