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

Fixed memory leak!!!!! Finally...

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8681 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8f104054
...@@ -38,10 +38,7 @@ import java.io.IOException; ...@@ -38,10 +38,7 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
...@@ -73,7 +70,7 @@ public class LocalOutgoingServerSession extends LocalSession implements Outgoing ...@@ -73,7 +70,7 @@ public class LocalOutgoingServerSession extends LocalSession implements Outgoing
private static Pattern pattern = Pattern.compile("[a-zA-Z]"); private static Pattern pattern = Pattern.compile("[a-zA-Z]");
private Collection<String> authenticatedDomains = new ArrayList<String>(); private Collection<String> authenticatedDomains = new ArrayList<String>();
private Collection<String> hostnames = new ArrayList<String>(); private final Collection<String> hostnames = new HashSet<String>();
private OutgoingServerSocketReader socketReader; private OutgoingServerSocketReader socketReader;
/** /**
* Flag that indicates if the session was created usign server-dialback. * Flag that indicates if the session was created usign server-dialback.
...@@ -590,11 +587,17 @@ public class LocalOutgoingServerSession extends LocalSession implements Outgoing ...@@ -590,11 +587,17 @@ public class LocalOutgoingServerSession extends LocalSession implements Outgoing
} }
public Collection<String> getHostnames() { public Collection<String> getHostnames() {
synchronized (hostnames) {
return Collections.unmodifiableCollection(hostnames); return Collections.unmodifiableCollection(hostnames);
} }
}
public void addHostname(String hostname) { public void addHostname(String hostname) {
if (hostnames.add(hostname)) { boolean added;
synchronized (hostnames) {
added = hostnames.add(hostname);
}
if (added) {
// Add a new route for this new session // Add a new route for this new session
XMPPServer.getInstance().getRoutingTable().addServerRoute(new JID(hostname), this); XMPPServer.getInstance().getRoutingTable().addServerRoute(new JID(hostname), this);
} }
......
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