[hornetq-commits] JBoss hornetq SVN: r12072 - in branches/Branch_2_2_EAP: tests/src/org/hornetq/tests/unit/ra and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Feb 3 06:21:53 EST 2012
Author: ataylor
Date: 2012-02-03 06:21:52 -0500 (Fri, 03 Feb 2012)
New Revision: 12072
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/ConnectionFactoryProperties.java
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/HornetQResourceAdapterConfigTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
Log:
https://issues.jboss.org/browse/JBPAPP-8040 - added local bind address to RA
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/ConnectionFactoryProperties.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/ConnectionFactoryProperties.java 2012-02-03 11:13:56 UTC (rev 12071)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/ConnectionFactoryProperties.java 2012-02-03 11:21:52 UTC (rev 12072)
@@ -52,6 +52,8 @@
private Integer discoveryPort;
+ private String discoveryLocalBindAddress;
+
private Long discoveryRefreshTimeout;
private Long discoveryInitialWaitTimeout;
@@ -183,6 +185,25 @@
return discoveryPort;
}
+ public void setDiscoveryLocalBindAddress(final String discoveryLocalBindAddress)
+ {
+ if (ConnectionFactoryProperties.trace)
+ {
+ ConnectionFactoryProperties.log.trace("setDiscoveryLocalBindAddress(" + discoveryLocalBindAddress + ")");
+ }
+ hasBeenUpdated = true;
+ this.discoveryLocalBindAddress = discoveryLocalBindAddress;
+ }
+
+ public String getDiscoveryLocalBindAddress()
+ {
+ if (ConnectionFactoryProperties.trace)
+ {
+ ConnectionFactoryProperties.log.trace("getDiscoveryLocalBindAddress()");
+ }
+ return discoveryLocalBindAddress;
+ }
+
public void setDiscoveryPort(final Integer discoveryPort)
{
if (ConnectionFactoryProperties.trace)
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2012-02-03 11:13:56 UTC (rev 12071)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2012-02-03 11:21:52 UTC (rev 12072)
@@ -42,7 +42,6 @@
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.core.logging.Logger;
import org.hornetq.jms.client.HornetQConnectionFactory;
-import org.hornetq.jms.server.recovery.XARecoveryConfig;
import org.hornetq.ra.inflow.HornetQActivation;
import org.hornetq.ra.inflow.HornetQActivationSpec;
import org.hornetq.ra.recovery.RecoveryManager;
@@ -371,6 +370,36 @@
}
/**
+ * set the discovery local bind address
+ *
+ * @param discoveryLocalBindAddress the address value
+ */
+ public void setDiscoveryLocalBindAddress(final String discoveryLocalBindAddress)
+ {
+ if (HornetQResourceAdapter.trace)
+ {
+ HornetQResourceAdapter.log.trace("setDiscoveryLocalBindAddress(" + discoveryLocalBindAddress + ")");
+ }
+
+ raProperties.setDiscoveryLocalBindAddress(discoveryLocalBindAddress);
+ }
+
+ /**
+ * get the discovery local bind address
+ *
+ * @return the address value
+ */
+ public String getDiscoveryLocalBindAddress()
+ {
+ if (HornetQResourceAdapter.trace)
+ {
+ HornetQResourceAdapter.log.trace("getDiscoveryLocalBindAddress()");
+ }
+
+ return raProperties.getDiscoveryLocalBindAddress();
+ }
+
+ /**
* Set the discovery group port
*
* @param dgp The value
@@ -1463,7 +1492,7 @@
{
Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ? overrideProperties.getDiscoveryPort()
: getDiscoveryPort();
-
+
if(discoveryPort == null)
{
discoveryPort = HornetQClient.DEFAULT_DISCOVERY_PORT;
@@ -1495,6 +1524,11 @@
groupConfiguration.setRefreshTimeout(refreshTimeout);
+ String localBindAddress = overrideProperties.getDiscoveryLocalBindAddress() != null ? overrideProperties.getDiscoveryLocalBindAddress()
+ : raProperties.getDiscoveryLocalBindAddress();
+
+ groupConfiguration.setLocalBindAdress(localBindAddress);
+
if (ha)
{
cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.XA_CF);
@@ -1603,6 +1637,11 @@
groupConfiguration.setRefreshTimeout(refreshTimeout);
+ String localBindAddress = overrideProperties.getDiscoveryLocalBindAddress() != null ? overrideProperties.getDiscoveryLocalBindAddress()
+ : raProperties.getDiscoveryLocalBindAddress();
+
+ groupConfiguration.setLocalBindAdress(localBindAddress);
+
cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.XA_CF);
}
else
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/HornetQResourceAdapterConfigTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/HornetQResourceAdapterConfigTest.java 2012-02-03 11:13:56 UTC (rev 12071)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/HornetQResourceAdapterConfigTest.java 2012-02-03 11:21:52 UTC (rev 12072)
@@ -101,6 +101,12 @@
" </config-property>\n" +
" <config-property>\n" +
" <description>The discovery group address</description>\n" +
+ " <config-property-name>DiscoveryLocalBindAddress</config-property-name>\n" +
+ " <config-property-type>java.lang.String</config-property-type>\n" +
+ " <config-property-value></config-property-value>\n" +
+ " </config-property>\n" +
+ " <config-property>\n" +
+ " <description>The discovery group local bind address</description>\n" +
" <config-property-name>DiscoveryAddress</config-property-name>\n" +
" <config-property-type>java.lang.String</config-property-type>\n" +
" <config-property-value></config-property-value>\n" +
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2012-02-03 11:13:56 UTC (rev 12071)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2012-02-03 11:21:52 UTC (rev 12072)
@@ -263,9 +263,13 @@
ConnectionFactoryProperties connectionFactoryProperties = new ConnectionFactoryProperties();
connectionFactoryProperties.setDiscoveryAddress("myhost");
connectionFactoryProperties.setDiscoveryPort(5678);
+ connectionFactoryProperties.setDiscoveryLocalBindAddress("newAddress");
HornetQConnectionFactory factory = ra.createHornetQConnectionFactory(connectionFactoryProperties);
HornetQConnectionFactory defaultFactory = ra.getDefaultHornetQConnectionFactory();
Assert.assertNotSame(factory, defaultFactory);
+ Assert.assertEquals(factory.getDiscoveryGroupConfiguration().getLocalBindAddress(), "newAddress");
+ Assert.assertEquals(factory.getDiscoveryGroupConfiguration().getGroupAddress(), "myhost");
+ Assert.assertEquals(factory.getDiscoveryGroupConfiguration().getGroupPort(), 5678);
}
public void testCreateConnectionFactoryMultipleConnectors()
More information about the hornetq-commits
mailing list