Author: jmesnil
Date: 2010-09-28 10:04:04 -0400 (Tue, 28 Sep 2010)
New Revision: 9727
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java
Log:
HA fixes for multiple backups
* set *initial* reconnect attempts to -1 on the server locator that the backup uses to
connect to the live server
* update backup topology with notifications received from the connection to the live
server
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-09-28
09:59:05 UTC (rev 9726)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-09-28
14:04:04 UTC (rev 9727)
@@ -1211,6 +1211,11 @@
}
}
+ public Topology getTopology()
+ {
+ return topology;
+ }
+
public void addClusterTopologyListener(final ClusterTopologyListener listener)
{
topologyListeners.add(listener);
@@ -1320,7 +1325,7 @@
factory = getFactory();
try
{
- factory.connect(reconnectAttempts, failoverOnInitialConnection);
+ factory.connect(initialConnectAttempts, failoverOnInitialConnection);
}
catch (HornetQException e)
{
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java 2010-09-28
09:59:05 UTC (rev 9726)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java 2010-09-28
14:04:04 UTC (rev 9727)
@@ -57,4 +57,6 @@
void setBackup(boolean backup);
void setInitialConnectAttempts(int reconnectAttempts);
+
+ Topology getTopology();
}
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java 2010-09-28
09:59:05 UTC (rev 9726)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java 2010-09-28
14:04:04 UTC (rev 9727)
@@ -50,7 +50,6 @@
}
else
{
- System.out.println("current=" + currentMember + ", new=" +
member);
if(hasChanged(currentMember.getConnector().a, member.getConnector().a)
&& member.getConnector().a != null)
{
currentMember.getConnector().a = member.getConnector().a;
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-09-28
09:59:05 UTC (rev 9726)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-09-28
14:04:04 UTC (rev 9727)
@@ -133,7 +133,7 @@
this.serverLocator.setClusterConnection(true);
this.serverLocator.setClusterTransportConfiguration(connector);
this.serverLocator.setBackup(server.getConfiguration().isBackup());
- this.serverLocator.setReconnectAttempts(-1);
+ this.serverLocator.setInitialConnectAttempts(-1);
if(retryInterval > 0)
{
this.serverLocator.setRetryInterval(retryInterval);
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-09-28
09:59:05 UTC (rev 9726)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-09-28
14:04:04 UTC (rev 9727)
@@ -209,14 +209,15 @@
{
public void nodeUP(String nodeID, String sourceNodeID,
Pair<TransportConfiguration, TransportConfiguration> connectorPair, boolean last,
int distance)
{
- //todo update the topology
+ notifyNodeUp(nodeID, sourceNodeID, connectorPair, last, distance);
}
public void nodeDown(String nodeID)
{
- //todo update the topology
+ notifyNodeDown(nodeID);
}
});
+ locator.setNodeID(nodeUUID.toString());
backupSessionFactory = locator.connect();
backupSessionFactory.getConnection().getChannel(0, -1).send(new
NodeAnnounceMessage(nodeUUID.toString(), nodeUUID.toString(), true,
configuration.getConnectorConfigurations().get(connectorConfiguration.getConnector())));
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java 2010-09-28
09:59:05 UTC (rev 9726)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java 2010-09-28
14:04:04 UTC (rev 9727)
@@ -33,6 +33,7 @@
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ServerLocatorImpl;
+import org.hornetq.core.client.impl.ServerLocatorInternal;
import org.hornetq.core.server.cluster.impl.FakeLockFile;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.integration.cluster.util.TestableServer;
@@ -158,6 +159,10 @@
sf = (ClientSessionFactoryInternal)locator.createSessionFactory();
boolean ok = countDownLatch.await(5, TimeUnit.SECONDS);
+ if (!ok)
+ {
+ System.out.println(((ServerLocatorInternal)locator).getTopology().describe());
+ }
assertTrue(ok);
return sf;
}
Show replies by date