Author: ataylor
Date: 2010-10-26 03:50:27 -0400 (Tue, 26 Oct 2010)
New Revision: 9814
Added:
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-beans.xml
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-configuration.xml
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-jms.xml
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-users.xml
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/jndi.properties
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/logging.properties
Removed:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/BackupConnectorConfiguration.java
Modified:
branches/2_2_0_HA_Improvements/build-hornetq.xml
branches/2_2_0_HA_Improvements/src/config/common/schema/hornetq-configuration.xsd
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-configuration.xml
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-jms.xml
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
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/cluster/impl/DiscoveryGroupImpl.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/Configuration.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/NodeManager.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/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/InVMNodeManager.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/NodeManagerAction.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
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/MultipleLivesMultipleBackupsFailoverTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServerSupport.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
Log:
added failback - also allow cluster connections to wait indefinately for discovery -
removed backup connector config
Modified: branches/2_2_0_HA_Improvements/build-hornetq.xml
===================================================================
--- branches/2_2_0_HA_Improvements/build-hornetq.xml 2010-10-26 00:08:05 UTC (rev 9813)
+++ branches/2_2_0_HA_Improvements/build-hornetq.xml 2010-10-26 07:50:27 UTC (rev 9814)
@@ -98,6 +98,7 @@
<property name="src.config.standalone.clustered.dir"
value="${src.dir}/config/stand-alone/clustered"/>
<property name="src.config.trunk.non-clustered.dir"
value="${src.dir}/config/trunk/non-clustered"/>
<property name="src.config.trunk.clustered.dir"
value="${src.dir}/config/trunk/clustered"/>
+ <property name="src.config.trunk.clustered.backup.dir"
value="${src.dir}/config/trunk/clustered-backup"/>
<property name="src.config.jbossas4.non-clustered.dir"
value="${src.dir}/config/jboss-as-4/non-clustered"/>
<property name="src.config.jbossas4.clustered.dir"
value="${src.dir}/config/jboss-as-4/clustered"/>
<property name="src.config.jbossas5.non-clustered.dir"
value="${src.dir}/config/jboss-as-5/non-clustered"/>
@@ -1658,17 +1659,20 @@
<target name="runBackup1" depends="jar">
<mkdir dir="logs"/>
- <property name="server.config"
value="${src.dir}/config/ha-test/backup-1"/>
- <java
classname="org.hornetq.integration.bootstrap.HornetQBootstrapServer"
fork="false">
+ <property name="server.config"
value="${src.config.trunk.clustered.backup.dir}"/>
+ <java
classname="org.hornetq.integration.bootstrap.HornetQBootstrapServer"
fork="true">
<jvmarg value="-XX:+UseParallelGC"/>
<jvmarg value="-Xms512M"/>
<jvmarg value="-Xmx2048M"/>
<jvmarg value="-XX:+AggressiveOpts"/>
<jvmarg value="-XX:+UseFastAccessorMethods"/>
<jvmarg value="-Dcom.sun.management.jmxremote"/>
- <jvmarg
value="-Djava.util.logging.config.file=${src.config.trunk.non-clustered.dir}/logging.properties"/>
+ <jvmarg
value="-Djava.util.logging.config.file=${src.config.trunk.clustered.backup.dir}/logging.properties"/>
<jvmarg value="-Djava.library.path=${native.bin.dir}"/>
- <!--<jvmarg line="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>-->
+ <jvmarg value="-Dhornetq.remoting.netty.port=5446"/>
+ <jvmarg value="-Djnp.port=1199"/>
+ <jvmarg value="-Djnp.rmiPort=1198"/>
+ <jvmarg line="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
<arg line="hornetq-beans.xml"/>
<classpath path="${server.config}" />
<classpath refid="jms.standalone.server.classpath"/>
@@ -1677,16 +1681,19 @@
<target name="runBackup2" depends="jar">
<mkdir dir="logs"/>
- <property name="server.config"
value="${src.dir}/config/ha-test/backup-2"/>
- <java
classname="org.hornetq.integration.bootstrap.HornetQBootstrapServer"
fork="false">
+ <property name="server.config"
value="${src.config.trunk.clustered.backup.dir}"/>
+ <java
classname="org.hornetq.integration.bootstrap.HornetQBootstrapServer"
fork="true">
<jvmarg value="-XX:+UseParallelGC"/>
<jvmarg value="-Xms512M"/>
<jvmarg value="-Xmx2048M"/>
<jvmarg value="-XX:+AggressiveOpts"/>
<jvmarg value="-XX:+UseFastAccessorMethods"/>
<jvmarg value="-Dcom.sun.management.jmxremote"/>
- <jvmarg
value="-Djava.util.logging.config.file=${src.config.trunk.non-clustered.dir}/logging.properties"/>
+ <jvmarg
value="-Djava.util.logging.config.file=${src.config.trunk.clustered.backup.dir}/logging.properties"/>
<jvmarg value="-Djava.library.path=${native.bin.dir}"/>
+ <jvmarg value="-Dhornetq.remoting.netty.port=5447"/>
+ <jvmarg value="-Djnp.port=1299"/>
+ <jvmarg value="-Djnp.rmiPort=1298"/>
<!--<jvmarg line="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>-->
<arg line="hornetq-beans.xml"/>
<classpath path="${server.config}" />
@@ -1696,16 +1703,19 @@
<target name="runBackup3" depends="jar">
<mkdir dir="logs"/>
- <property name="server.config"
value="${src.dir}/config/ha-test/backup-3"/>
- <java
classname="org.hornetq.integration.bootstrap.HornetQBootstrapServer"
fork="false">
+ <property name="server.config"
value="${src.config.trunk.clustered.backup.dir}"/>
+ <java
classname="org.hornetq.integration.bootstrap.HornetQBootstrapServer"
fork="true">
<jvmarg value="-XX:+UseParallelGC"/>
<jvmarg value="-Xms512M"/>
<jvmarg value="-Xmx2048M"/>
<jvmarg value="-XX:+AggressiveOpts"/>
<jvmarg value="-XX:+UseFastAccessorMethods"/>
<jvmarg value="-Dcom.sun.management.jmxremote"/>
- <jvmarg
value="-Djava.util.logging.config.file=${src.config.trunk.non-clustered.dir}/logging.properties"/>
+ <jvmarg
value="-Djava.util.logging.config.file=${src.config.trunk.clustered.backup.dir}/logging.properties"/>
<jvmarg value="-Djava.library.path=${native.bin.dir}"/>
+ <jvmarg value="-Dhornetq.remoting.netty.port=5448"/>
+ <jvmarg value="-Djnp.port=1399"/>
+ <jvmarg value="-Djnp.rmiPort=1398"/>
<!--<jvmarg line="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>-->
<arg line="hornetq-beans.xml"/>
<classpath path="${server.config}" />
@@ -1747,12 +1757,14 @@
<jvmarg value="-Djnp.port=${jnp.port}"/>
<jvmarg value="-Djnp.rmiPort=${jnp.rmiPort}"/>
<jvmarg value="-Dhornetq.data.dir=${hornetq.data.dir}"/>
+ <!-- <jvmarg line="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
<arg line="hornetq-beans.xml"/>
<classpath path="${src.config.trunk.clustered.dir}" />
<classpath refid="jms.standalone.server.classpath"/>
</java>
</target>
+
<target name="debugServer" depends="jar">
<property name="server.config"
value="${src.config.trunk.non-clustered.dir}"/>
<mkdir dir="logs"/>
Modified:
branches/2_2_0_HA_Improvements/src/config/common/schema/hornetq-configuration.xsd
===================================================================
---
branches/2_2_0_HA_Improvements/src/config/common/schema/hornetq-configuration.xsd 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/config/common/schema/hornetq-configuration.xsd 2010-10-26
07:50:27 UTC (rev 9814)
@@ -66,7 +66,9 @@
<xsd:element maxOccurs="1" minOccurs="0"
ref="remoting-interceptors">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="backup" type="xsd:boolean">
- </xsd:element>
+ </xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0"
name="allow-failback" type="xsd:boolean">
+ </xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="shared-store" type="xsd:boolean">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="persist-delivery-count-before-delivery" type="xsd:boolean">
Modified:
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-configuration.xml
===================================================================
---
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-configuration.xml 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-configuration.xml 2010-10-26
07:50:27 UTC (rev 9814)
@@ -3,6 +3,8 @@
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
<clustered>true</clustered>
+
+ <shared-store>true</shared-store>
<journal-min-files>10</journal-min-files>
@@ -12,13 +14,6 @@
<param key="host"
value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port"
value="${hornetq.remoting.netty.port:5445}"/>
</connector>
-
- <connector name="netty-throughput">
-
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
- <param key="host"
value="${hornetq.remoting.netty.host:localhost}"/>
- <param key="port"
value="${hornetq.remoting.netty.port:5455}"/>
- <param key="batch-delay" value="50"/>
- </connector>
</connectors>
<acceptors>
@@ -27,14 +22,6 @@
<param key="host"
value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port"
value="${hornetq.remoting.netty.port:5445}"/>
</acceptor>
-
- <acceptor name="netty-throughput">
-
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
- <param key="host"
value="${jboss.bind.address:localhost}"/>
- <param key="port"
value="${hornetq.remoting.netty.port:5455}"/>
- <param key="batch-delay" value="50"/>
- <param key="direct-deliver" value="false"/>
- </acceptor>
</acceptors>
<broadcast-groups>
@@ -50,7 +37,7 @@
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
- <refresh-timeout>10000</refresh-timeout>
+ <refresh-timeout>60000</refresh-timeout>
</discovery-group>
</discovery-groups>
Modified: branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-jms.xml
===================================================================
--- branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-jms.xml 2010-10-26
00:08:05 UTC (rev 9813)
+++ branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-jms.xml 2010-10-26
07:50:27 UTC (rev 9814)
@@ -12,16 +12,6 @@
</entries>
</connection-factory>
- <connection-factory name="NettyThroughputConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-throughput"/>
- </connectors>
- <entries>
- <entry name="/ThroughputConnectionFactory"/>
- <entry name="/XAThroughputConnectionFactory"/>
- </entries>
- </connection-factory>
-
<queue name="DLQ">
<entry name="/queue/DLQ"/>
</queue>
Copied: branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-beans.xml
(from rev 9794,
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-beans.xml)
===================================================================
--- branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-beans.xml
(rev 0)
+++
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-beans.xml 2010-10-26
07:50:27 UTC (rev 9814)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright 2009 Red Hat, Inc.
+ ~ Red Hat licenses this file to you under the Apache License, version
+ ~ 2.0 (the "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
http://www.apache.org/licenses/LICENSE-2.0
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ ~ implied. See the License for the specific language governing
+ ~ permissions and limitations under the License.
+ -->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="Naming" class="org.jnp.server.NamingBeanImpl"/>
+
+ <!-- JNDI server. Disable this if you don't want JNDI -->
+ <bean name="JNDIServer" class="org.jnp.server.Main">
+ <property name="namingInfo">
+ <inject bean="Naming"/>
+ </property>
+ <property name="port">${jnp.port:1199}</property>
+ <property
name="bindAddress">${jnp.host:localhost}</property>
+ <property name="rmiPort">${jnp.rmiPort:1198}</property>
+ <property
name="rmiBindAddress">${jnp.host:localhost}</property>
+ </bean>
+
+ <!-- MBean server -->
+ <bean name="MBeanServer"
class="javax.management.MBeanServer">
+ <constructor factoryClass="java.lang.management.ManagementFactory"
+ factoryMethod="getPlatformMBeanServer"/>
+ </bean>
+
+ <!-- The core configuration -->
+ <bean name="Configuration"
class="org.hornetq.core.config.impl.FileConfiguration">
+ </bean>
+
+ <!-- The security manager -->
+ <bean name="HornetQSecurityManager"
class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="HornetQServer"
class="org.hornetq.core.server.impl.HornetQServerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="HornetQSecurityManager"/>
+ </parameter>
+ </constructor>
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager"
class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="HornetQServer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+
+</deployment>
\ No newline at end of file
Copied:
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-configuration.xml
(from rev 9794,
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-configuration.xml)
===================================================================
---
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-configuration.xml
(rev 0)
+++
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-configuration.xml 2010-10-26
07:50:27 UTC (rev 9814)
@@ -0,0 +1,90 @@
+<!--
+ ~ Copyright 2009 Red Hat, Inc.
+ ~ Red Hat licenses this file to you under the Apache License, version
+ ~ 2.0 (the "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
http://www.apache.org/licenses/LICENSE-2.0
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ ~ implied. See the License for the specific language governing
+ ~ permissions and limitations under the License.
+ -->
+
+<configuration xmlns="urn:hornetq"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+ <clustered>true</clustered>
+
+ <backup>true</backup>
+
+ <allow-failback>true</allow-failback>
+
+ <shared-store>true</shared-store>
+
+ <journal-min-files>10</journal-min-files>
+
+ <connectors>
+ <connector name="netty">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+ <param key="host"
value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="port"
value="${hornetq.remoting.netty.port:5446}"/>
+ </connector>
+ </connectors>
+
+ <acceptors>
+ <acceptor name="netty">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+ <param key="host"
value="${hornetq.remoting.netty.host:localhost}"/>
+ <param key="port"
value="${hornetq.remoting.netty.port:5446}"/>
+ </acceptor>
+ </acceptors>
+
+ <broadcast-groups>
+ <broadcast-group name="bg-group1">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <broadcast-period>5000</broadcast-period>
+ <connector-ref>netty</connector-ref>
+ </broadcast-group>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <discovery-group name="dg-group1">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <refresh-timeout>60000</refresh-timeout>
+ </discovery-group>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <connector-ref>netty</connector-ref>
+ <discovery-group-ref discovery-group-name="dg-group1"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <security-settings>
+ <security-setting match="#">
+ <permission type="createNonDurableQueue" roles="guest"/>
+ <permission type="deleteNonDurableQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
+ </security-settings>
+
+ <address-settings>
+ <!--default for catch all-->
+ <address-setting match="#">
+ <dead-letter-address>jms.queue.DLQ</dead-letter-address>
+ <expiry-address>jms.queue.ExpiryQueue</expiry-address>
+ <redelivery-delay>0</redelivery-delay>
+ <max-size-bytes>10485760</max-size-bytes>
+
<message-counter-history-day-limit>10</message-counter-history-day-limit>
+ <address-full-policy>BLOCK</address-full-policy>
+ </address-setting>
+ </address-settings>
+
+</configuration>
Copied: branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-jms.xml
(from rev 9794,
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-jms.xml)
===================================================================
--- branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-jms.xml
(rev 0)
+++
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-jms.xml 2010-10-26
07:50:27 UTC (rev 9814)
@@ -0,0 +1,28 @@
+<configuration xmlns="urn:hornetq"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+
+ <connection-factory name="ConnectionFactory">
+ <connectors>
+ <connector-ref connector-name="netty"/>
+ </connectors>
+ <entries>
+ <entry name="/ConnectionFactory"/>
+ <entry name="/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="DLQ">
+ <entry name="/queue/DLQ"/>
+ </queue>
+ <queue name="ExpiryQueue">
+ <entry name="/queue/ExpiryQueue"/>
+ </queue>
+ <queue name="ExampleQueue">
+ <entry name="/queue/ExampleQueue"/>
+ </queue>
+ <topic name="ExampleTopic">
+ <entry name="/topic/ExampleTopic"/>
+ </topic>
+
+</configuration>
\ No newline at end of file
Copied: branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-users.xml
(from rev 9794,
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/hornetq-users.xml)
===================================================================
--- branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-users.xml
(rev 0)
+++
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/hornetq-users.xml 2010-10-26
07:50:27 UTC (rev 9814)
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-users.xsd">
+ <!-- the default user. this is used where username is null-->
+ <defaultuser name="guest" password="guest">
+ <role name="guest"/>
+ </defaultuser>
+</configuration>
\ No newline at end of file
Copied: branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/jndi.properties
(from rev 9794,
branches/2_2_0_HA_Improvements/src/config/trunk/clustered/jndi.properties)
===================================================================
--- branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/jndi.properties
(rev 0)
+++
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/jndi.properties 2010-10-26
07:50:27 UTC (rev 9814)
@@ -0,0 +1,15 @@
+#
+# Copyright 2009 Red Hat, Inc.
+# Red Hat licenses this file to you under the Apache License, version
+# 2.0 (the "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Copied:
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/logging.properties (from
rev 9794, branches/2_2_0_HA_Improvements/src/config/trunk/clustered/logging.properties)
===================================================================
--- branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/logging.properties
(rev 0)
+++
branches/2_2_0_HA_Improvements/src/config/trunk/clustered-backup/logging.properties 2010-10-26
07:50:27 UTC (rev 9814)
@@ -0,0 +1,34 @@
+############################################################
+# Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
+java.util.logging.ConsoleHandler.formatter=org.hornetq.integration.logging.HornetQLoggerFormatter
+java.util.logging.FileHandler.level=INFO
+java.util.logging.FileHandler.pattern=logs/hornetq.log
+java.util.logging.FileHandler.formatter=org.hornetq.integration.logging.HornetQLoggerFormatter
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= INFO
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -399,11 +399,11 @@
return;
}
-
+
+ //we need to stopthe factory from connecting if it is in the middle aof trying to
failover before we get the lock
+ causeExit();
synchronized (createSessionLock)
{
- //we need to stopthe factory from connecting if it is in the middle aof trying
to failover before we get the lock
- causeExit();
synchronized (failoverLock)
{
// work on a copied set. the session will be removed from sessions when
session.close() is called
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -1655,7 +1655,7 @@
private void checkClosed() throws HornetQException
{
- if (closed)
+ if (closed || inClose)
{
throw new HornetQException(HornetQException.OBJECT_CLOSED, "Session is
closed");
}
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-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -494,9 +494,9 @@
if (initialConnectors == null && discoveryGroup != null)
{
// Wait for an initial broadcast to give us at least one node in the cluster
+ long timeout = clusterConnection?0:discoveryInitialWaitTimeout;
+ boolean ok = discoveryGroup.waitForBroadcast(timeout);
- boolean ok = discoveryGroup.waitForBroadcast(discoveryInitialWaitTimeout);
-
if (!ok)
{
throw new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
@@ -1272,7 +1272,7 @@
log.debug("unable to connect with static connector " +
connectors.get(i).initialConnector);
}
}
- if (csf == null)
+ if (csf == null && !closed)
{
throw new HornetQException(HornetQException.NOT_CONNECTED, "Failed to
connect to any static connectors");
}
@@ -1282,7 +1282,7 @@
throw new HornetQException(HornetQException.NOT_CONNECTED, "Failed to
connect to any static connectors", e);
}
- if (csf == null)
+ if (csf == null && !closed)
{
throw new HornetQException(HornetQException.NOT_CONNECTED, "Failed to
connect to any static connectors");
}
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -222,7 +222,7 @@
long toWait = timeout;
- while (!received && toWait > 0)
+ while (!received && (toWait > 0 || timeout == 0))
{
try
{
@@ -232,11 +232,14 @@
{
}
- long now = System.currentTimeMillis();
+ if (timeout != 0)
+ {
+ long now = System.currentTimeMillis();
- toWait -= now - start;
+ toWait -= now - start;
- start = now;
+ start = now;
+ }
}
boolean ret = received;
Deleted:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/BackupConnectorConfiguration.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/BackupConnectorConfiguration.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/BackupConnectorConfiguration.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -1,64 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.config;
-
-import org.hornetq.api.core.TransportConfiguration;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * Created by IntelliJ IDEA.
- * User: andy
- * Date: Sep 2, 2010
- * Time: 11:36:13 AM
- * To change this template use File | Settings | File Templates.
- */
-public class BackupConnectorConfiguration implements Serializable
-{
- private final List<String> staticConnectors;
-
- private final String discoveryGroupName;
-
- private String connector;
-
- public BackupConnectorConfiguration(List<String> staticConnectors, String
connector)
- {
- this.staticConnectors = staticConnectors;
- this.discoveryGroupName = null;
- this.connector = connector;
- }
-
- public List<String> getStaticConnectors()
- {
- return staticConnectors;
- }
-
- public String getDiscoveryGroupName()
- {
- return discoveryGroupName;
- }
-
- public BackupConnectorConfiguration(String discoveryGroupName, String connector)
- {
- this.staticConnectors = null;
- this.discoveryGroupName = discoveryGroupName;
- this.connector = connector;
- }
-
- public String getConnector()
- {
- return connector;
- }
-}
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/Configuration.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/Configuration.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/Configuration.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -51,6 +51,19 @@
void setClustered(boolean clustered);
/**
+ * returns whether a backup will auto die when a live server is failing back
+ * @return
+ */
+ public boolean isAllowAutoFailBack();
+
+ /**
+ * whether a backup will auto die when a live server is failing back
+ *
+ * @param allowAutoFailBack true if allowed
+ */
+ public void setAllowAutoFailBack(boolean allowAutoFailBack);
+
+ /**
* Returns whether delivery count is persisted before messages are delivered to the
consumers.
* <br>
* Default value is {@value
org.hornetq.core.config.impl.ConfigurationImpl#DEFAULT_PERSIST_DELIVERY_COUNT_BEFORE_DELIVERY}.
@@ -252,18 +265,7 @@
*/
Map<String, TransportConfiguration> getConnectorConfigurations();
-
- /**
- * sets the connectors used to get topology info from for the backup server when shared
store is used.
- */
- void setBackupConnectorConfiguration(BackupConnectorConfiguration
backupConnectorConfiguration);
-
/**
- * Returns the connectors used to get topology info from for the backup server when
shared store is used.
- */
- BackupConnectorConfiguration getBackupConnectorConfiguration();
-
- /**
* Sets the connectors configured for this server.
*/
void setConnectorConfigurations(Map<String, TransportConfiguration> infos);
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -46,6 +46,8 @@
public static final boolean DEFAULT_BACKUP = false;
+ public static final boolean DEFAULT_ALLOW_AUTO_FAILBACK = true;
+
public static final boolean DEFAULT_SHARED_STORE = false;
public static final boolean DEFAULT_FILE_DEPLOYMENT_ENABLED = false;
@@ -177,6 +179,8 @@
protected boolean backup = ConfigurationImpl.DEFAULT_BACKUP;
+ protected boolean allowAutoFailBack = ConfigurationImpl.DEFAULT_ALLOW_AUTO_FAILBACK;
+
protected boolean sharedStore = ConfigurationImpl.DEFAULT_SHARED_STORE;
protected boolean fileDeploymentEnabled =
ConfigurationImpl.DEFAULT_FILE_DEPLOYMENT_ENABLED;
@@ -231,8 +235,6 @@
protected List<BroadcastGroupConfiguration> broadcastGroupConfigurations = new
ArrayList<BroadcastGroupConfiguration>();
- protected BackupConnectorConfiguration backupConnectorConfiguration;
-
protected Map<String, DiscoveryGroupConfiguration> discoveryGroupConfigurations
= new LinkedHashMap<String, DiscoveryGroupConfiguration>();
// Paging related attributes
------------------------------------------------------------
@@ -330,6 +332,16 @@
this.clustered = clustered;
}
+ public boolean isAllowAutoFailBack()
+ {
+ return allowAutoFailBack;
+ }
+
+ public void setAllowAutoFailBack(boolean allowAutoFailBack)
+ {
+ this.allowAutoFailBack = allowAutoFailBack;
+ }
+
public boolean isBackup()
{
return backup;
@@ -468,16 +480,6 @@
return connectorConfigs;
}
- public void setBackupConnectorConfiguration(BackupConnectorConfiguration
backupConnectorConfiguration)
- {
- this.backupConnectorConfiguration = backupConnectorConfiguration;
- }
-
- public BackupConnectorConfiguration getBackupConnectorConfiguration()
- {
- return backupConnectorConfiguration;
- }
-
public void setConnectorConfigurations(final Map<String, TransportConfiguration>
infos)
{
connectorConfigs = infos;
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -27,13 +27,7 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.config.BridgeConfiguration;
-import org.hornetq.core.config.BroadcastGroupConfiguration;
-import org.hornetq.core.config.ClusterConnectionConfiguration;
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.CoreQueueConfiguration;
-import org.hornetq.core.config.DiscoveryGroupConfiguration;
-import org.hornetq.core.config.DivertConfiguration;
+import org.hornetq.core.config.*;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.config.impl.FileConfiguration;
import org.hornetq.core.config.impl.Validators;
@@ -150,6 +144,8 @@
config.setClustered(XMLConfigurationUtil.getBoolean(e, "clustered",
config.isClustered()));
+ config.setAllowAutoFailBack(XMLConfigurationUtil.getBoolean(e,
"allow-failback", config.isClustered()));
+
config.setBackup(XMLConfigurationUtil.getBoolean(e, "backup",
config.isBackup()));
config.setSharedStore(XMLConfigurationUtil.getBoolean(e, "shared-store",
config.isSharedStore()));
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -250,7 +250,7 @@
long start = System.currentTimeMillis();
- while (response == null && toWait > 0)
+ while (!closed && response == null && toWait > 0)
{
try
{
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/NodeManager.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/NodeManager.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/NodeManager.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -38,6 +38,8 @@
public abstract void stopBackup() throws Exception;
+ public abstract void releaseBackup() throws Exception;
+
private boolean isStarted = false;
protected volatile SimpleString nodeID;
@@ -69,4 +71,8 @@
{
return uuid;
}
+
+ public abstract boolean isAwaitingFailback() throws Exception;
+
+ public abstract void killServer();
}
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-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -229,7 +229,7 @@
}
}
- public synchronized void stop() throws Exception
+ public void stop() throws Exception
{
if (!started)
{
@@ -241,34 +241,37 @@
serverLocator.removeClusterTopologyListener(this);
}
- for (MessageFlowRecord record : records.values())
+ synchronized (this)
{
- try
+ for (MessageFlowRecord record : records.values())
{
- record.close();
+ try
+ {
+ record.close();
+ }
+ catch (Exception ignore)
+ {
+ }
}
- catch (Exception ignore)
+
+ if (serverLocator != null)
{
+ serverLocator.close();
}
- }
- if (serverLocator != null)
- {
- serverLocator.close();
- }
+ if (managementService != null)
+ {
+ TypedProperties props = new TypedProperties();
+ props.putSimpleStringProperty(new SimpleString("name"), name);
+ Notification notification = new Notification(nodeUUID.toString(),
+
NotificationType.CLUSTER_CONNECTION_STOPPED,
+ props);
+ managementService.sendNotification(notification);
+ }
- if (managementService != null)
- {
- TypedProperties props = new TypedProperties();
- props.putSimpleStringProperty(new SimpleString("name"), name);
- Notification notification = new Notification(nodeUUID.toString(),
-
NotificationType.CLUSTER_CONNECTION_STOPPED,
- props);
- managementService.sendNotification(notification);
+ started = false;
}
-
- started = false;
}
public boolean isStarted()
@@ -399,7 +402,7 @@
// actually routed to at that address though
queue = server.createQueue(queueName, queueName, null, true, false);
}
-
+
createNewRecord(nodeID, connectorPair.a, queueName, queue, true);
}
else
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-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -148,11 +148,6 @@
if (clustered)
{
- BackupConnectorConfiguration connectorConfiguration =
configuration.getBackupConnectorConfiguration();
- if(connectorConfiguration != null)
- {
- deployBackupListener(connectorConfiguration);
- }
for (BroadcastGroupConfiguration config :
configuration.getBroadcastGroupConfigurations())
{
deployBroadcastGroup(config);
@@ -180,49 +175,7 @@
started = true;
}
- private void deployBackupListener(BackupConnectorConfiguration
connectorConfiguration)
- throws Exception
- {
- ServerLocatorInternal locator;
- if (connectorConfiguration.getDiscoveryGroupName() != null)
- {
- DiscoveryGroupConfiguration groupConfiguration =
configuration.getDiscoveryGroupConfigurations().get(connectorConfiguration.getDiscoveryGroupName());
- if (groupConfiguration == null)
- {
- ClusterManagerImpl.log.warn("There is no discovery group deployed with
name " + connectorConfiguration.getDiscoveryGroupName() +
- " deployed. This one will not be
deployed.");
- return;
- }
- locator = new ServerLocatorImpl(true, groupConfiguration.getGroupAddress(),
groupConfiguration.getGroupPort());
- }
- else
- {
- TransportConfiguration[] configs = new
TransportConfiguration[connectorConfiguration.getStaticConnectors().size()];
- for (int i = 0, configsLength = configs.length; i < configsLength; i++)
- {
- configs[i] =
configuration.getConnectorConfigurations().get(connectorConfiguration.getStaticConnectors().get(i));
- }
- locator = new ServerLocatorImpl(true, configs);
- }
- locator.addClusterTopologyListener(new ClusterTopologyListener()
- {
- public void nodeUP(String nodeID, String sourceNodeID,
Pair<TransportConfiguration, TransportConfiguration> connectorPair, boolean last,
int distance)
- {
- notifyNodeUp(nodeID, sourceNodeID, connectorPair, last, distance);
- }
-
- public void nodeDown(String nodeID)
- {
- notifyNodeDown(nodeID);
- }
- });
- locator.setNodeID(nodeUUID.toString());
- locator.setReconnectAttempts(-1);
- backupSessionFactory = locator.connect();
- backupSessionFactory.getConnection().getChannel(0, -1).send(new
NodeAnnounceMessage(nodeUUID.toString(), nodeUUID.toString(), true,
configuration.getConnectorConfigurations().get(connectorConfiguration.getConnector())));
- }
-
public synchronized void stop() throws Exception
{
if (!started)
@@ -795,8 +748,46 @@
{
clusterConnection.start();
}
+ else
+ {
+ announceBackup(config, connector);
+ }
}
+ private void announceBackup(ClusterConnectionConfiguration config,
TransportConfiguration connector) throws Exception
+ {
+ ServerLocatorInternal locator;
+
+ if (config.getStaticConnectors() != null)
+ {
+ TransportConfiguration[] tcConfigs =
connectorNameListToArray(config.getStaticConnectors());
+
+ locator =
(ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(tcConfigs);
+ locator.setReconnectAttempts(-1);
+ }
+ else if (config.getDiscoveryGroupName() != null)
+ {
+ DiscoveryGroupConfiguration dg =
configuration.getDiscoveryGroupConfigurations()
+
.get(config.getDiscoveryGroupName());
+
+ if (dg == null)
+ {
+ ClusterManagerImpl.log.warn("No discovery group with name '" +
config.getDiscoveryGroupName() +
+ "'. The cluster connection will not be
deployed.");
+ }
+
+ locator =
(ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(dg.getGroupAddress(),
dg.getGroupPort());
+ locator.setReconnectAttempts(-1);
+ locator.setDiscoveryInitialWaitTimeout(0);
+ }
+ else
+ {
+ return;
+ }
+ backupSessionFactory = locator.connect();
+ backupSessionFactory.getConnection().getChannel(0, -1).send(new
NodeAnnounceMessage(nodeUUID.toString(), nodeUUID.toString(), true, connector));
+ }
+
private Transformer instantiateTransformer(final String transformerClassName)
{
Transformer transformer = null;
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -86,13 +86,32 @@
super.stop();
}
+ @Override
+ public boolean isAwaitingFailback() throws Exception
+ {
+ return getState() == FAILINGBACK;
+ }
+ @Override
+ public void killServer()
+ {
+ System.exit(0);
+ }
+
+ @Override
+ public void releaseBackup() throws Exception
+ {
+ releaseBackupLock();
+ }
+
+
public void awaitLiveNode() throws Exception
{
do
{
while (getState() == NOT_STARTED)
{
+ log.info("awaiting live node startup");
Thread.sleep(2000);
}
@@ -103,17 +122,17 @@
if (state == PAUSED)
{
liveLock.release();
+ log.info("awaiting live node restarting");
Thread.sleep(2000);
}
else if (state == FAILINGBACK)
{
liveLock.release();
+ log.info("awaiting live node failing back");
Thread.sleep(2000);
}
else if (state == LIVE)
{
- releaseBackupLock();
-
break;
}
}
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -358,6 +358,30 @@
clusterManager.activate();
log.info("Backup Server is now live");
+
+ nodeManager.releaseBackup();
+ if(configuration.isAllowAutoFailBack())
+ {
+ //todo dont hardcode schedule timings
+ scheduledPool.scheduleAtFixedRate(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ if(nodeManager.isAwaitingFailback())
+ {
+ log.info("live server wants to restart, killing
server");
+ nodeManager.killServer();
+ }
+ }
+ catch (Exception e)
+ {
+ log.warn("unable to kill server, please kill manually to
force failback");
+ }
+ }
+ }, 1000l, 1000l, TimeUnit.MILLISECONDS);
+ }
}
catch (InterruptedException e)
{
@@ -685,7 +709,7 @@
try
{
- if (!threadPool.awaitTermination(30000, TimeUnit.MILLISECONDS))
+ if (!threadPool.awaitTermination(5000, TimeUnit.MILLISECONDS))
{
HornetQServerImpl.log.warn("Timed out waiting for pool to
terminate");
}
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/InVMNodeManager.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/InVMNodeManager.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/impl/InVMNodeManager.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -69,7 +69,6 @@
}
else if (state == LIVE)
{
- releaseBackupNode();
break;
}
}
@@ -111,6 +110,24 @@
backupLock.release();
}
+ @Override
+ public void releaseBackup()
+ {
+ releaseBackupNode();
+ }
+
+ @Override
+ public boolean isAwaitingFailback() throws Exception
+ {
+ return state == FAILING_BACK;
+ }
+
+ @Override
+ public void killServer()
+ {
+ //todo
+ }
+
private void releaseBackupNode()
{
if(backupLock != null)
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/NodeManagerAction.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/NodeManagerAction.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/NodeManagerAction.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -31,12 +31,14 @@
public final static int PAUSE_LIVE = 3;
public final static int STOP_BACKUP = 4;
public final static int AWAIT_LIVE = 5;
+ public final static int RELEASE_BACKUP = 6;
public final static int HAS_LIVE = 10;
public final static int HAS_BACKUP = 11;
public final static int DOESNT_HAVE_LIVE = 12;
public final static int DOESNT_HAVE_BACKUP = 13;
+
private final int[] work;
boolean hasLiveLock = false;
@@ -77,8 +79,10 @@
case AWAIT_LIVE:
nodeManager.awaitLiveNode();
hasLiveLock = true;
+ break;
+ case RELEASE_BACKUP:
+ nodeManager.releaseBackup();
hasBackupLock = false;
- break;
case HAS_LIVE:
if (!hasLiveLock)
{
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -37,22 +37,22 @@
public void testSimpleLiveAndBackup() throws Exception
{
NodeManagerAction live1 = new NodeManagerAction(START_LIVE, HAS_LIVE,
DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, PAUSE_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
+ NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
PAUSE_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
performWork(live1, backup1);
}
public void testSimpleBackupAndLive() throws Exception
{
NodeManagerAction live1 = new NodeManagerAction(START_LIVE, HAS_LIVE,
DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, PAUSE_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
+ NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
PAUSE_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
performWork(backup1, live1);
}
public void testSimpleLiveAnd2Backups() throws Exception
{
NodeManagerAction live1 = new NodeManagerAction(START_LIVE, HAS_LIVE,
DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
+ NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
+ NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
performWork(live1, backup1, backup2);
}
@@ -60,24 +60,24 @@
public void testSimple2BackupsAndLive() throws Exception
{
NodeManagerAction live1 = new NodeManagerAction(START_LIVE, HAS_LIVE,
DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
+ NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
+ NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
performWork(backup1, backup2, live1);
}
public void testSimpleLiveAnd2BackupsPaused() throws Exception
{
NodeManagerAction live1 = new NodeManagerAction(START_LIVE, HAS_LIVE,
DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, PAUSE_LIVE, START_LIVE,
HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, PAUSE_LIVE, START_LIVE,
HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
+ NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
PAUSE_LIVE, START_LIVE, HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE);
+ NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
PAUSE_LIVE, START_LIVE, HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE);
performWork(live1, backup1, backup2);
}
public void testSimple2BackupsPausedAndLive() throws Exception
{
NodeManagerAction live1 = new NodeManagerAction(START_LIVE, HAS_LIVE,
DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, PAUSE_LIVE, START_LIVE,
HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
- NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, PAUSE_LIVE, START_LIVE,
HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE);
+ NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
PAUSE_LIVE, START_LIVE, HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE);
+ NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
PAUSE_LIVE, START_LIVE, HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE);
performWork(backup1, backup2, live1);
}
@@ -100,15 +100,15 @@
public void testLiveAndBackupLiveForcesFailback() throws Exception
{
NodeManagerAction live1 = new NodeManagerAction(START_LIVE, HAS_LIVE,
DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE, START_LIVE,
HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE);
- NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE, AWAIT_LIVE, HAS_LIVE, PAUSE_LIVE);
+ NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE, AWAIT_LIVE, HAS_LIVE, PAUSE_LIVE);
performWork(live1, backup1);
}
public void testLiveAnd2BackupsLiveForcesFailback() throws Exception
{
NodeManagerAction live1 = new NodeManagerAction(START_LIVE, HAS_LIVE,
DOESNT_HAVE_BACKUP, CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE, START_LIVE,
HAS_LIVE, DOESNT_HAVE_BACKUP, CRASH_LIVE);
- NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE);
- NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE,
DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE, AWAIT_LIVE, HAS_LIVE, CRASH_LIVE);
+ NodeManagerAction backup1 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE);
+ NodeManagerAction backup2 = new NodeManagerAction(DOESNT_HAVE_BACKUP,
DOESNT_HAVE_LIVE, START_BACKUP, HAS_BACKUP, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE, DOESNT_HAVE_BACKUP, DOESNT_HAVE_LIVE, AWAIT_LIVE, RELEASE_BACKUP, HAS_LIVE,
CRASH_LIVE);
performWork(live1, backup1, backup2);
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -1381,8 +1381,6 @@
configuration.getConnectorConfigurations().put(backupConfig.getName(),
backupConfig);
ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(liveConfig.getName());
- BackupConnectorConfiguration bcc = new
BackupConnectorConfiguration(staticConnectors, backupConfig.getName());
- configuration.setBackupConnectorConfiguration(bcc);
HornetQServer server;
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -189,6 +189,8 @@
createQueue(0, "queues.testaddress", "queue0", null, false);
addConsumer(0, 0, "queue0", null);
+ waitForBindings(0, "queues.testaddress", 1, 1, true);
+
send(0, "queues.testaddress", 10, false, null);
verifyReceiveAll(10, 0);
verifyNotReceive(0);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -35,7 +35,6 @@
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ServerLocatorInternal;
-import org.hornetq.core.config.BackupConnectorConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
@@ -138,7 +137,6 @@
backupConfig.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(liveConnector.getName());
- backupConfig.setBackupConnectorConfiguration(new
BackupConnectorConfiguration(staticConnectors, backupConnector.getName()));
backupServer = createBackupServer();
// FIXME
@@ -283,7 +281,7 @@
fail("backup server never started");
}
}
- System.out.println("FailoverTestBase.waitForBackup");
+ System.out.println("FailoverTestBase.waitForNewLive");
}
protected TransportConfiguration getInVMConnectorTransportConfiguration(final boolean
live)
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-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -70,19 +70,34 @@
protected abstract boolean isNetty();
- protected int waitForBackup(long seconds, Map<Integer, TestableServer> servers,
int... nodes)
+ protected int waitForNewLive(long seconds, boolean waitForNewBackup, Map<Integer,
TestableServer> servers, int... nodes)
{
long time = System.currentTimeMillis();
long toWait = seconds * 1000;
+ int newLive = -1;
while (true)
{
for (int node : nodes)
{
TestableServer backupServer = servers.get(node);
- if (backupServer.isInitialised())
+ if (newLive == -1 && backupServer.isInitialised())
{
- return node;
+ newLive = node;
}
+ else if(newLive != -1)
+ {
+ if(waitForNewBackup)
+ {
+ if(node != newLive && servers.get(node).isStarted())
+ {
+ return newLive;
+ }
+ }
+ else
+ {
+ return newLive;
+ }
+ }
}
try
{
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -23,7 +23,6 @@
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ServerLocatorInternal;
-import org.hornetq.core.config.BackupConnectorConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.server.NodeManager;
@@ -85,7 +84,7 @@
System.out.println(((ServerLocatorInternal)locator).getTopology().describe());
servers.get(0).crash(session);
- int liveAfter0 = waitForBackup(10000, servers, 1, 2);
+ int liveAfter0 = waitForNewLive(10000, true, servers, 1, 2);
ServerLocator locator2 = getServerLocator(3);
locator2.setBlockOnNonDurableSend(true);
@@ -97,7 +96,7 @@
System.setProperty("foo", "bar");
servers.get(3).crash(session2);
- int liveAfter3 = waitForBackup(10000, servers, 4, 5);
+ int liveAfter3 = waitForNewLive(10000, true, servers, 4, 5);
if (liveAfter0 == 2)
{
@@ -140,8 +139,6 @@
staticConnectors.add(liveConnector.getName());
}
TransportConfiguration backupConnector = createTransportConfiguration(isNetty(),
false, generateParams(nodeid, isNetty()));
- BackupConnectorConfiguration connectorConfiguration = new
BackupConnectorConfiguration(staticConnectors, backupConnector.getName());
- config1.setBackupConnectorConfiguration(connectorConfiguration);
config1.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
List<String> clusterNodes = new ArrayList<String>();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -19,7 +19,6 @@
import java.util.Map;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.core.config.BackupConnectorConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -166,8 +165,6 @@
staticConnectors.add(liveConnector.getName());
}
TransportConfiguration backupConnector = createTransportConfiguration(true, false,
generateParams(nodeid, true));
- BackupConnectorConfiguration connectorConfiguration = new
BackupConnectorConfiguration(staticConnectors, backupConnector.getName());
- config1.setBackupConnectorConfiguration(connectorConfiguration);
config1.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
List<String> clusterNodes = new ArrayList<String>();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -22,7 +22,6 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
-import org.hornetq.core.config.BackupConnectorConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -73,7 +72,7 @@
servers.get(0).crash(session);
session.close();
- backupNode = waitForBackup(5, servers, 1, 2, 3);
+ backupNode = waitForNewLive(5, true, servers, 1, 2, 3);
session = sendAndConsume(sf, false);
System.out.println("restarting live node as a backup");
@@ -93,7 +92,7 @@
System.out.println("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
- backupNode = waitForBackup(5, servers, 0);
+ backupNode = waitForNewLive(5, true, servers, 0);
assertEquals(0, backupNode);
session = sendAndConsume(sf, false);
@@ -149,7 +148,7 @@
servers.put(liveNode, new
RemoteProcessHornetQServer(SharedLiveServerConfiguration.class.getName()));
}
- @Override
+
protected void createBackupConfig(int liveNode, int nodeid, boolean
createClusterConnections, int... nodes)
{
servers.put(nodeid, new RemoteProcessHornetQServer(backups.get(nodeid)));
@@ -273,8 +272,6 @@
ClusterConnectionConfiguration ccc1 = new
ClusterConnectionConfiguration("cluster1", "jms",
backupConnector.getName(), -1, false, false, 1, 1,
createClusterConnections? staticConnectors:pairs);
config1.getClusterConfigurations().add(ccc1);
- BackupConnectorConfiguration connectorConfiguration = new
BackupConnectorConfiguration(staticConnectors, backupConnector.getName());
- config1.setBackupConnectorConfiguration(connectorConfiguration);
config1.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
System.out.println(config1.getBindingsDirectory());
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -13,20 +13,15 @@
package org.hornetq.tests.integration.cluster.failover;
-import static java.util.concurrent.TimeUnit.SECONDS;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executors;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
-import org.hornetq.core.config.BackupConnectorConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.server.NodeManager;
@@ -46,11 +41,11 @@
{
nodeManager = new InVMNodeManager();
createLiveConfig(0);
- createBackupConfig(0, 1,false, 0, 2, 3, 4, 5);
- createBackupConfig(0, 2,false, 0, 1, 3, 4, 5);
- createBackupConfig(0, 3,false, 0, 1, 2, 4, 5);
- createBackupConfig(0, 4, false, 0, 1, 2, 3, 5);
- createBackupConfig(0, 5, false, 0, 1, 2, 3, 4);
+ createBackupConfig(0, 1, 0, 2, 3, 4, 5);
+ createBackupConfig(0, 2, 0, 1, 3, 4, 5);
+ createBackupConfig(0, 3, 0, 1, 2, 4, 5);
+ createBackupConfig(0, 4, 0, 1, 2, 3, 5);
+ createBackupConfig(0, 5, 0, 1, 2, 3, 4);
servers.get(0).start();
servers.get(1).start();
servers.get(2).start();
@@ -69,39 +64,39 @@
ClientSession session = sendAndConsume(sf, true);
System.out.println("failing node 0");
servers.get(0).crash(session);
-
+
session.close();
- backupNode = waitForBackup(5, servers, 1, 2, 3, 4, 5);
+ backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
System.out.println("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
- backupNode = waitForBackup(5, servers, 1, 2, 3, 4, 5);
+ backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
System.out.println("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
- backupNode = waitForBackup(5, servers, 1, 2, 3, 4, 5);
+ backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
System.out.println("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
- backupNode = waitForBackup(5, servers, 1, 2, 3, 4, 5);
+ backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
System.out.println("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
- backupNode = waitForBackup(5, servers, 1, 2, 3, 4, 5);
+ backupNode = waitForNewLive(5, false, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
session.close();
servers.get(backupNode).stop();
}
- protected void createBackupConfig(int liveNode, int nodeid, boolean
createClusterConnections, int... nodes)
+ protected void createBackupConfig(int liveNode, int nodeid, int... nodes)
{
Configuration config1 = super.createDefaultConfig();
config1.getAcceptorConfigurations().clear();
@@ -119,12 +114,8 @@
staticConnectors.add(liveConnector.getName());
}
TransportConfiguration backupConnector = createTransportConfiguration(isNetty(),
false, generateParams(nodeid, isNetty()));
- List<String> pairs = null;
- ClusterConnectionConfiguration ccc1 = new
ClusterConnectionConfiguration("cluster1", "jms",
backupConnector.getName(), -1, false, false, 1, 1,
- createClusterConnections? staticConnectors:pairs);
+ ClusterConnectionConfiguration ccc1 = new
ClusterConnectionConfiguration("cluster1", "jms",
backupConnector.getName(), -1, false, false, 1, 1, staticConnectors);
config1.getClusterConfigurations().add(ccc1);
- BackupConnectorConfiguration connectorConfiguration = new
BackupConnectorConfiguration(staticConnectors, backupConnector.getName());
- config1.setBackupConnectorConfiguration(connectorConfiguration);
config1.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
config1.setBindingsDirectory(config1.getBindingsDirectory() + "_" +
liveNode);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServer.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -36,7 +36,8 @@
private Process serverProcess;
private boolean initialised = false;
private CountDownLatch initLatch;
-
+ private boolean started;
+
public RemoteProcessHornetQServer(String configurationClassName)
{
this.configurationClassName = configurationClassName;
@@ -74,6 +75,11 @@
}
}
+ public boolean isStarted()
+ {
+ return started;
+ }
+
public void setInitialised(boolean initialised)
{
this.initialised = initialised;
@@ -146,4 +152,8 @@
// Inner classes -------------------------------------------------
+ public void setStarted(boolean init)
+ {
+ started = true;
+ }
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServerSupport.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServerSupport.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/RemoteProcessHornetQServerSupport.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -64,6 +64,10 @@
{
System.out.println("INIT:" + server.isInitialised());
}
+ else if ("STARTED?".equals(line.trim()))
+ {
+ System.out.println("STARTED:" + server.isStarted());
+ }
else if ("STOP".equals(line.trim()))
{
server.stop();
@@ -124,6 +128,11 @@
boolean init =
Boolean.parseBoolean(line.substring("INIT:".length(), line.length()));
remoteProcessHornetQServer.setInitialised(init);
}
+ if (line.startsWith("STARTED:"))
+ {
+ boolean init =
Boolean.parseBoolean(line.substring("STARTED:".length(), line.length()));
+ remoteProcessHornetQServer.setStarted(init);
+ }
}
}
catch (Exception e)
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -53,6 +53,11 @@
//To change body of implemented methods use File | Settings | File Templates.
}
+ public boolean isStarted()
+ {
+ return server.isStarted();
+ }
+
public void start() throws Exception
{
server.start();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/util/TestableServer.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -33,4 +33,6 @@
public boolean isInitialised();
void destroy();
+
+ boolean isStarted();
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-10-26
00:08:05 UTC (rev 9813)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-10-26
07:50:27 UTC (rev 9814)
@@ -37,7 +37,6 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.core.client.impl.ClientSessionInternal;
-import org.hornetq.core.config.BackupConnectorConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -337,7 +336,6 @@
backupConf.getConnectorConfigurations().put(backuptc.getName(), backuptc);
ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(livetc.getName());
- backupConf.setBackupConnectorConfiguration(new
BackupConnectorConfiguration(staticConnectors, backuptc.getName()) );
backupConf.setSecurityEnabled(false);
backupConf.setJournalType(getDefaultJournalType());