You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/06/24 15:51:22 UTC
[1/2] qpid-jms git commit: QPIDJMS-76: configure broker to use the
same interface as the JUnit assumption check did,
ensure there isn't a mismatch in multihomed environments
Repository: qpid-jms
Updated Branches:
refs/heads/master 71716b8db -> 8b9ab1491
QPIDJMS-76: configure broker to use the same interface as the JUnit assumption check did, ensure there isn't a mismatch in multihomed environments
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/8b9ab149
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/8b9ab149
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/8b9ab149
Branch: refs/heads/master
Commit: 8b9ab1491b6de9c4e75d2926e8dca75c951b2d32
Parents: 49b6674
Author: Robert Gemmell <ro...@apache.org>
Authored: Wed Jun 24 14:36:56 2015 +0100
Committer: Robert Gemmell <ro...@apache.org>
Committed: Wed Jun 24 14:51:05 2015 +0100
----------------------------------------------------------------------
.../apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java | 8 ++++++++
.../java/org/apache/qpid/jms/support/AmqpTestSupport.java | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8b9ab149/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java
index d1d8360..70f0ca7 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/discovery/JmsAmqpDiscoveryTest.java
@@ -55,6 +55,8 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti
private static final Logger LOG = LoggerFactory.getLogger(JmsAmqpDiscoveryTest.class);
private static boolean multicastWorking = false;
+ private static String networkInterface = null;
+
static
{
String host = MulticastDiscoveryAgent.DEFAULT_HOST_IP;
@@ -91,6 +93,7 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti
if(packetIn.getLength() > 0) {
LOG.info("Received packet with content, multicast seems to be working!");
success = true;
+ networkInterface = mcastRcv.getNetworkInterface().getName();
} else {
LOG.info("Received packet without content, lets assume multicast isnt working!");
}
@@ -227,6 +230,11 @@ public class JmsAmqpDiscoveryTest extends AmqpTestSupport implements JmsConnecti
return true;
}
+ @Override
+ protected String getDiscoveryNetworkInterface() {
+ return networkInterface;
+ }
+
protected Connection createFailingConnection() throws JMSException {
String discoveryPrefix = DiscoveryProviderFactory.DISCOVERY_OPTION_PREFIX;
JmsConnectionFactory factory = new JmsConnectionFactory(
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8b9ab149/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java
index fb7ade1..bc8b855 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/support/AmqpTestSupport.java
@@ -37,6 +37,10 @@ public class AmqpTestSupport extends QpidJmsTestSupport {
return false;
}
+ protected String getDiscoveryNetworkInterface() {
+ return null;
+ }
+
protected String getAmqpTransformer() {
return "jms";
}
@@ -60,7 +64,11 @@ public class AmqpTestSupport extends QpidJmsTestSupport {
"&transport.socketBufferSize=" + getSocketBufferSize() + "&ioBufferSize=" + getIOBufferSize());
connector.setName("amqp");
if (isAmqpDiscovery()) {
- connector.setDiscoveryUri(new URI("multicast://default"));
+ String uriString = "multicast://default";
+ if(getDiscoveryNetworkInterface() != null) {
+ uriString += "?networkInterface=" + getDiscoveryNetworkInterface();
+ }
+ connector.setDiscoveryUri(new URI(uriString));
}
port = connector.getPublishableConnectURI().getPort();
LOG.debug("Using amqp port: {}", port);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-jms git commit: QPIDJMS-77: improve logging of default
interface selection process,
update usage order of found interfaces for consistency with the brokers doing
the announcing
Posted by ro...@apache.org.
QPIDJMS-77: improve logging of default interface selection process, update usage order of found interfaces for consistency with the brokers doing the announcing
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/49b66746
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/49b66746
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/49b66746
Branch: refs/heads/master
Commit: 49b6674648ed87a9dcacb6839690706b43914563
Parents: 71716b8
Author: Robert Gemmell <ro...@apache.org>
Authored: Wed Jun 24 14:31:16 2015 +0100
Committer: Robert Gemmell <ro...@apache.org>
Committed: Wed Jun 24 14:51:05 2015 +0100
----------------------------------------------------------------------
.../multicast/MulticastDiscoveryAgent.java | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/49b66746/qpid-jms-discovery/src/main/java/org/apache/qpid/jms/provider/discovery/multicast/MulticastDiscoveryAgent.java
----------------------------------------------------------------------
diff --git a/qpid-jms-discovery/src/main/java/org/apache/qpid/jms/provider/discovery/multicast/MulticastDiscoveryAgent.java b/qpid-jms-discovery/src/main/java/org/apache/qpid/jms/provider/discovery/multicast/MulticastDiscoveryAgent.java
index 1c5e2c1..4576678 100644
--- a/qpid-jms-discovery/src/main/java/org/apache/qpid/jms/provider/discovery/multicast/MulticastDiscoveryAgent.java
+++ b/qpid-jms-discovery/src/main/java/org/apache/qpid/jms/provider/discovery/multicast/MulticastDiscoveryAgent.java
@@ -29,7 +29,6 @@ import java.net.SocketTimeoutException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
@@ -397,7 +396,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
}
public static void trySetNetworkInterface(MulticastSocket mcastSock) throws SocketException {
- List<NetworkInterface> interfaces = findNetworkInterface();
+ List<NetworkInterface> interfaces = findNetworkInterfaces();
SocketException lastError = null;
boolean found = false;
@@ -421,23 +420,30 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
}
}
- private static List<NetworkInterface> findNetworkInterface() throws SocketException {
+ private static List<NetworkInterface> findNetworkInterfaces() throws SocketException {
Enumeration<NetworkInterface> ifcs = NetworkInterface.getNetworkInterfaces();
List<NetworkInterface> interfaces = new ArrayList<NetworkInterface>();
while (ifcs.hasMoreElements()) {
NetworkInterface ni = ifcs.nextElement();
+ LOG.trace("findNetworkInterfaces checking interface: {}", ni);
+
if (ni.supportsMulticast() && ni.isUp()) {
for (InterfaceAddress ia : ni.getInterfaceAddresses()) {
if (ia.getAddress() instanceof java.net.Inet4Address &&
!ia.getAddress().isLoopbackAddress() &&
!DEFAULT_EXCLUSIONS.contains(ni.getName())) {
- interfaces.add(ni);
+ // Add at the start, make usage order consistent with the
+ // existing ActiveMQ releases discovery will be used with.
+ interfaces.add(0, ni);
+ break;
}
}
}
}
- return interfaces.isEmpty() ? Collections.<NetworkInterface>emptyList() : interfaces;
+ LOG.trace("findNetworkInterfaces returning: {}", interfaces);
+
+ return interfaces;
}
// ---------- Discovered Peer Bookkeeping Class ---------------------------//
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org