Author: clebert.suconic(a)jboss.com
Date: 2011-03-07 21:19:56 -0500 (Mon, 07 Mar 2011)
New Revision: 10303
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
Fixing test
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java 2011-03-07
22:29:14 UTC (rev 10302)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java 2011-03-08
02:19:56 UTC (rev 10303)
@@ -18,12 +18,12 @@
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
+import java.net.SocketException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.ExecutorService;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
@@ -171,6 +171,10 @@
waitLock.notify();
}
+ socket.close();
+
+ socket = null;
+
try
{
thread.interrupt();
@@ -184,10 +188,6 @@
{
}
- socket.close();
-
- socket = null;
-
thread = null;
if (notificationService != null)
@@ -306,6 +306,17 @@
{
socket.receive(packet);
}
+ catch (SocketException e)
+ {
+ if (!started)
+ {
+ return;
+ }
+ else
+ {
+ log.warn(e.getMessage(), e);
+ }
+ }
catch (InterruptedIOException e)
{
if (!started)
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-03-07
22:29:14 UTC (rev 10302)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-03-08
02:19:56 UTC (rev 10303)
@@ -23,7 +23,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.Executors;
import junit.framework.Assert;
@@ -434,19 +433,18 @@
public void testMultipleGroups() throws Exception
{
+ final int groupPort1 = getUDPDiscoveryPort();
+
+ final int groupPort2 = getUDPDiscoveryPort(1);
- System.out.println("address1=" + address1 + " address2 = " +
address2 + " address3 = " + address3);
+ final int groupPort3 = getUDPDiscoveryPort(2);
+
final InetAddress groupAddress1 = InetAddress.getByName(DiscoveryTest.address1);
- final int groupPort1 = getUDPDiscoveryPort();
final InetAddress groupAddress2 = InetAddress.getByName(DiscoveryTest.address2);
- final int groupPort2 = getUDPDiscoveryPort(1);
final InetAddress groupAddress3 = InetAddress.getByName(DiscoveryTest.address3);
- final int groupPort3 = getUDPDiscoveryPort(2);
- System.out.println("port1 =" + groupPort1 + " port2 = " +
groupPort1 + " port3 = " + groupPort3);
-
final int timeout = 5000;
String node1 = "node-1::" + RandomUtil.randomString();
@@ -517,13 +515,10 @@
dg3.start();
bg1.broadcastConnectors();
- Thread.sleep(1000);
bg2.broadcastConnectors();
- Thread.sleep(1000);
bg3.broadcastConnectors();
- Thread.sleep(1000);
boolean ok = dg1.waitForBroadcast(timeout);
Assert.assertTrue(ok);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-03-07
22:29:14 UTC (rev 10302)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-03-08
02:19:56 UTC (rev 10303)
@@ -229,7 +229,7 @@
public static int getUDPDiscoveryPort(final int variant)
{
- return getUDPDiscoveryPort() + 1;
+ return getUDPDiscoveryPort() + variant;
}
protected static JournalType getDefaultJournalType()
Show replies by date