Author: clebert.suconic(a)jboss.com
Date: 2011-12-19 09:33:24 -0500 (Mon, 19 Dec 2011)
New Revision: 11912
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
https://issues.jboss.org/browse/JBPAPP-7785 - protecting factories usage - simple fix
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-12-19
13:58:48 UTC (rev 11911)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-12-19
14:33:24 UTC (rev 11912)
@@ -1417,10 +1417,13 @@
if (actMember != null && actMember.getConnector().getA() != null &&
actMember.getConnector().getB() != null)
{
- for (ClientSessionFactory factory : factories)
+ synchronized (factories)
{
-
((ClientSessionFactoryInternal)factory).setBackupConnector(actMember.getConnector().getA(),
-
actMember.getConnector().getB());
+ for (ClientSessionFactory factory : factories)
+ {
+
((ClientSessionFactoryInternal)factory).setBackupConnector(actMember.getConnector().getA(),
+
actMember.getConnector().getB());
+ }
}
}
@@ -1526,17 +1529,20 @@
}
}
- public synchronized void factoryClosed(final ClientSessionFactory factory)
+ public void factoryClosed(final ClientSessionFactory factory)
{
- factories.remove(factory);
-
- if (!clusterConnection && factories.isEmpty())
+ synchronized (factories)
{
- // Go back to using the broadcast or static list
-
- receivedTopology = false;
-
- topologyArray = null;
+ factories.remove(factory);
+
+ if (!clusterConnection && factories.isEmpty())
+ {
+ // Go back to using the broadcast or static list
+
+ receivedTopology = false;
+
+ topologyArray = null;
+ }
}
}
@@ -1555,7 +1561,7 @@
topology.removeClusterTopologyListener(listener);
}
- private synchronized void addFactory(ClientSessionFactoryInternal factory)
+ private void addFactory(ClientSessionFactoryInternal factory)
{
if (factory == null)
{