Commit bb584fce authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed inconsistency when removing components associated with a domain. (only applies to 3.4.5)

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches@9868 b35dd754-fafc-0310-a699-88a17e54d16e
parent d730a03c
......@@ -24,10 +24,10 @@ import org.xmpp.component.ComponentManager;
import org.xmpp.component.ComponentManagerFactory;
import org.xmpp.packet.*;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.LinkedBlockingQueue;
......@@ -162,15 +162,29 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
}
}
/**
* Removes a component. The {@link Component#shutdown} method will be called on the
* component. Note that if the component was an external component that was connected
* several times then all its connections will be terminated.
*
* @param subdomain the subdomain of the component's address.
*/
public void removeComponent(String subdomain) {
synchronized (routables) {
Log.debug("InternalComponentManager: Unregistering all components for domain: " + subdomain);
RoutableComponents routable = routables.get(subdomain);
routable.removeAllComponents();
routables.remove(subdomain);
List<Component> componentsToRemove = new ArrayList<Component>(routables.get(subdomain).getComponents());
for (Component component : componentsToRemove) {
removeComponent(subdomain, component);
}
}
/**
* Removes a given component. Unlike {@link #removeComponent(String)} this method will just
* remove a single component instead of all components associated to the subdomain. External
* components may connect several times and register for the same subdomain. This method
* just removes a singled connection not all of them.
*
* @param subdomain the subdomain of the component's address.
* @param component specific component to remove.
*/
public void removeComponent(String subdomain, Component component) {
synchronized (routables) {
Log.debug("InternalComponentManager: Unregistering component for domain: " + subdomain);
......@@ -578,4 +592,4 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
component.processPacket(packet);
}
}
}
\ No newline at end of file
}
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