Commit 0243861c authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Implemented rotation of CS components.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10122 b35dd754-fafc-0310-a699-88a17e54d16e
parent b4497851
...@@ -114,7 +114,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM ...@@ -114,7 +114,7 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
/** /**
* Keep the domains of Clearspace components * Keep the domains of Clearspace components
*/ */
private List<String> clearspaces = new ArrayList<String>(); private final List<String> clearspaces = new ArrayList<String>();
/** /**
* Provides singleton access to an instance of the ClearspaceManager class. * Provides singleton access to an instance of the ClearspaceManager class.
...@@ -854,9 +854,13 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM ...@@ -854,9 +854,13 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
if (clearspaces.isEmpty()) { if (clearspaces.isEmpty()) {
return null; return null;
} }
// Set the target address to the IQ packet // Set the target address to the IQ packet. Roate list so we distribute load
// TODO Use round robin to distribute load String component;
packet.setTo(clearspaces.get(0)); synchronized (clearspaces) {
component = clearspaces.get(0);
Collections.rotate(clearspaces, 1);
}
packet.setTo(component);
final LinkedBlockingQueue<IQ> answer = new LinkedBlockingQueue<IQ>(8); final LinkedBlockingQueue<IQ> answer = new LinkedBlockingQueue<IQ>(8);
final IQRouter router = XMPPServer.getInstance().getIQRouter(); final IQRouter router = XMPPServer.getInstance().getIQRouter();
router.addIQResultListener(packet.getID(), new IQResultListener() { router.addIQResultListener(packet.getID(), new IQResultListener() {
......
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