[jboss-remoting-commits] JBoss Remoting SVN: r5060 - remoting2/branches/2.2/src/main/org/jboss/remoting.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Sat Apr 18 02:33:42 EDT 2009
Author: ron.sigal at jboss.com
Date: 2009-04-18 02:33:42 -0400 (Sat, 18 Apr 2009)
New Revision: 5060
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java
Log:
JBREM-1119: Use copies of lists to avoid ConcurrentModificationException.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java 2009-04-18 06:33:21 UTC (rev 5059)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java 2009-04-18 06:33:42 UTC (rev 5060)
@@ -47,14 +47,17 @@
Client client = new Client(new InvokerLocator(locatorurl), requestPayload);
client.setSessionId(clientSessionId);
+ ArrayList localListeners = null;
synchronized (listeners)
{
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- ((ConnectionListener) it.next()).handleConnectionException(null, client);
- }
+ localListeners = new ArrayList(listeners);
}
+
+ Iterator it = localListeners.iterator();
+ while (it.hasNext())
+ {
+ ((ConnectionListener) it.next()).handleConnectionException(null, client);
+ }
}
catch(Exception e)
{
@@ -74,14 +77,17 @@
client.setSessionId(clientSessionId);
ClientDisconnectedException ex = new ClientDisconnectedException();
+ ArrayList localListeners = null;
synchronized (listeners)
{
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- ((ConnectionListener) it.next()).handleConnectionException(ex, client);
- }
+ localListeners = new ArrayList(listeners);
}
+
+ Iterator it = localListeners.iterator();
+ while (it.hasNext())
+ {
+ ((ConnectionListener) it.next()).handleConnectionException(ex, client);
+ }
}
catch(Exception e)
{
More information about the jboss-remoting-commits
mailing list