Author: ataylor
Date: 2011-07-07 11:54:23 -0400 (Thu, 07 Jul 2011)
New Revision: 10956
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/cluster/ClusterManager.java
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
Log:
cluster manager announces replicated backup fix
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/cluster/ClusterManager.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/cluster/ClusterManager.java 2011-07-07
14:51:04 UTC (rev 10955)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/cluster/ClusterManager.java 2011-07-07
15:54:23 UTC (rev 10956)
@@ -22,6 +22,7 @@
import org.hornetq.api.core.client.ClusterTopologyListener;
import org.hornetq.core.client.impl.Topology;
import org.hornetq.core.config.BridgeConfiguration;
+import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.server.HornetQComponent;
/**
@@ -56,7 +57,10 @@
void announceBackup() throws Exception;
+ void announceReplicatingBackup(Channel liveChannel);
+
void deployBridge(BridgeConfiguration config) throws Exception;
void destroyBridge(String name) throws Exception;
+
}
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-07-07
14:51:04 UTC (rev 10955)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-07-07
15:54:23 UTC (rev 10956)
@@ -44,6 +44,8 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.impl.wireformat.HaBackupRegistrationMessage;
import org.hornetq.core.protocol.core.impl.wireformat.NodeAnnounceMessage;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
@@ -462,6 +464,30 @@
}
}
+ @Override
+ public void announceReplicatingBackup(Channel liveChannel)
+ {
+ List<ClusterConnectionConfiguration> configs =
this.configuration.getClusterConfigurations();
+ if(!configs.isEmpty())
+ {
+ ClusterConnectionConfiguration config = configs.get(0);
+
+ TransportConfiguration connector =
configuration.getConnectorConfigurations().get(config.getConnectorName());
+
+ if (connector == null)
+ {
+ log.warn("No connector with name '" + config.getConnectorName()
+
+ "'. backup cannot be announced.");
+ return;
+ }
+ liveChannel.send(new HaBackupRegistrationMessage(nodeUUID.toString(),
connector));
+ }
+ else
+ {
+ log.warn("no cluster connections defined, unable to announce
backup");
+ }
+ }
+
private synchronized void announceNode()
{
// TODO does this really work with more than one cluster connection? I think not
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-07-07
14:51:04 UTC (rev 10955)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-07-07
15:54:23 UTC (rev 10956)
@@ -337,7 +337,14 @@
public void close(boolean permanently) throws Exception
{
-
+ if(permanently)
+ {
+ nodeManager.crashLiveServer();
+ }
+ else
+ {
+ nodeManager.pauseLiveServer();
+ }
}
}
@@ -558,7 +565,7 @@
connectToReplicationEndpoint(replicationChannel);
replicationEndpoint.start();
- liveChannel.send(new HaBackupRegistrationMessage(getNodeID().toString(),
config));
+ clusterManager.announceReplicatingBackup(liveChannel);
log.info("HornetQ Backup Server version " +
getVersion().getFullVersion() + " [" + nodeManager.getNodeId() +
"] started, waiting live to fail before it gets active");
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-07-07
14:51:04 UTC (rev 10955)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-07-07
15:54:23 UTC (rev 10956)
@@ -206,8 +206,8 @@
liveServer = createLiveServer();
liveServer.getServer().setIdentity("idLive");
- liveServer.start();
- backupServer.start();
+ //liveServer.start();
+ //backupServer.start();
}
@Override
Show replies by date