Commit e2d349bb authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Performance tweak.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6502 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1bab6601
...@@ -26,6 +26,7 @@ import org.dom4j.QName; ...@@ -26,6 +26,7 @@ import org.dom4j.QName;
import org.dom4j.Namespace; import org.dom4j.Namespace;
import java.util.*; import java.util.*;
import java.util.concurrent.CopyOnWriteArraySet;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
...@@ -47,7 +48,7 @@ public class HttpSession extends ClientSession { ...@@ -47,7 +48,7 @@ public class HttpSession extends ClientSession {
private boolean isSecure; private boolean isSecure;
private int maxPollingInterval; private int maxPollingInterval;
private long lastPoll = -1; private long lastPoll = -1;
private Set<SessionListener> listeners = new HashSet<SessionListener>(); private Set<SessionListener> listeners = new CopyOnWriteArraySet<SessionListener>();
private boolean isClosed; private boolean isClosed;
private int inactivityTimeout; private int inactivityTimeout;
private long lastActivity; private long lastActivity;
...@@ -150,8 +151,6 @@ public class HttpSession extends ClientSession { ...@@ -150,8 +151,6 @@ public class HttpSession extends ClientSession {
private void fireConnectionOpened(HttpConnection connection) { private void fireConnectionOpened(HttpConnection connection) {
lastActivity = System.currentTimeMillis(); lastActivity = System.currentTimeMillis();
Collection<SessionListener> listeners =
new HashSet<SessionListener>(this.listeners);
for(SessionListener listener : listeners) { for(SessionListener listener : listeners) {
listener.connectionOpened(this, connection); listener.connectionOpened(this, connection);
} }
...@@ -270,8 +269,6 @@ public class HttpSession extends ClientSession { ...@@ -270,8 +269,6 @@ public class HttpSession extends ClientSession {
private void fireConnectionClosed(HttpConnection connection) { private void fireConnectionClosed(HttpConnection connection) {
lastActivity = System.currentTimeMillis(); lastActivity = System.currentTimeMillis();
Collection<SessionListener> listeners =
new HashSet<SessionListener>(this.listeners);
for(SessionListener listener : listeners) { for(SessionListener listener : listeners) {
listener.connectionClosed(this, connection); listener.connectionClosed(this, connection);
} }
......
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