Author: clebert.suconic
Date: 2011-10-19 17:03:14 -0400 (Wed, 19 Oct 2011)
New Revision: 11564
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/server/cluster/impl/ClusterConnectionImpl.java
Log:
JBPAPP-7273 - Committing changes suggested by Andy Taylor
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-10-18
15:58:28 UTC (rev 11563)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-10-19
21:03:14 UTC (rev 11564)
@@ -1288,32 +1288,31 @@
log.debug("nodeDown " + this + " nodeID=" + nodeID + "
as being down", new Exception("trace"));
}
- if (topology.removeMember(eventTime, nodeID))
+ topology.removeMember(eventTime, nodeID);
+
+ if (clusterConnection)
{
- if (clusterConnection)
+ updateArraysAndPairs();
+ }
+ else
+ {
+ synchronized (this)
{
- updateArraysAndPairs();
- }
- else
- {
- synchronized (this)
+ if (topology.isEmpty())
{
- if (topology.isEmpty())
+ // Resetting the topology to its original condition as it was brand new
+ receivedTopology = false;
+ topologyArray = null;
+ }
+ else
+ {
+ updateArraysAndPairs();
+
+ if (topology.nodes() == 1 && topology.getMember(this.nodeID) !=
null)
{
// Resetting the topology to its original condition as it was brand
new
receivedTopology = false;
- topologyArray = null;
}
- else
- {
- updateArraysAndPairs();
-
- if (topology.nodes() == 1 && topology.getMember(this.nodeID) !=
null)
- {
- // Resetting the topology to its original condition as it was brand
new
- receivedTopology = false;
- }
- }
}
}
}
@@ -1338,23 +1337,21 @@
TopologyMember member = new TopologyMember(connectorPair.getA(),
connectorPair.getB());
- if (topology.updateMember(uniqueEventID, nodeID, member))
- {
+ topology.updateMember(uniqueEventID, nodeID, member);
- TopologyMember actMember = topology.getMember(nodeID);
+ TopologyMember actMember = topology.getMember(nodeID);
- if (actMember != null && actMember.getConnector().getA() != null
&& actMember.getConnector().getB() != null)
+ if (actMember != null && actMember.getConnector().getA() != null &&
actMember.getConnector().getB() != null)
+ {
+ for (ClientSessionFactory factory : factories)
{
- for (ClientSessionFactory factory : factories)
- {
-
((ClientSessionFactoryInternal)factory).setBackupConnector(actMember.getConnector().getA(),
-
actMember.getConnector().getB());
- }
+
((ClientSessionFactoryInternal)factory).setBackupConnector(actMember.getConnector().getA(),
+
actMember.getConnector().getB());
}
-
- updateArraysAndPairs();
}
+ updateArraysAndPairs();
+
if (last)
{
synchronized (this)
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-10-18
15:58:28 UTC (rev 11563)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-10-19
21:03:14 UTC (rev 11564)
@@ -348,7 +348,7 @@
clusterConnector = new DiscoveryClusterConnector(dg);
- backupServerLocator = clusterConnector.createServerLocator(false);
+ backupServerLocator = clusterConnector.createServerLocator(true);
if (backupServerLocator != null)
{
@@ -470,29 +470,33 @@
{
public void run()
{
- try
- {
- if (log.isDebugEnabled())
- {
- log.debug(ClusterConnectionImpl.this + ":: announcing " +
connector + " to " + backupServerLocator);
- }
- ClientSessionFactory backupSessionFactory =
backupServerLocator.connect();
- if (backupSessionFactory != null)
- {
- backupSessionFactory.getConnection()
- .getChannel(0, -1)
- .send(new
NodeAnnounceMessage(System.currentTimeMillis(),
- nodeUUID.toString(),
- true,
- connector,
- null));
- log.info("backup announced");
- }
- }
- catch (Exception e)
- {
- log.warn("Unable to announce backup, retrying", e);
- }
+ while (true)
+ {
+ try
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug(ClusterConnectionImpl.this + ":: announcing "
+ connector + " to " + backupServerLocator);
+ }
+ ClientSessionFactory backupSessionFactory =
backupServerLocator.connect();
+ if (backupSessionFactory != null)
+ {
+ backupSessionFactory.getConnection()
+ .getChannel(0, -1)
+ .send(new
NodeAnnounceMessage(System.currentTimeMillis(),
+
nodeUUID.toString(),
+ true,
+ connector,
+ null));
+ log.info("backup announced");
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to announce backup, retrying", e);
+ }
+ }
}
});
}
Show replies by date