JBoss hornetq SVN: r10996 - branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-07-18 18:05:44 -0400 (Mon, 18 Jul 2011)
New Revision: 10996
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
tweak
Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-07-18 22:05:10 UTC (rev 10995)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-07-18 22:05:44 UTC (rev 10996)
@@ -1790,7 +1790,7 @@
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
address,
name,
- 500,
+ 100,
true,
forwardWhenNoConsumers,
maxHops,
13 years, 8 months
JBoss hornetq SVN: r10995 - in branches/Branch_2_2_EAP_cluster_clean2: src/main/org/hornetq/core/server/cluster/impl and 1 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-07-18 18:05:10 -0400 (Mon, 18 Jul 2011)
New Revision: 10995
Modified:
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionBridge.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java
Log:
Fixing tests
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-07-18 17:05:58 UTC (rev 10994)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-07-18 22:05:10 UTC (rev 10995)
@@ -660,7 +660,10 @@
}
else
{
- connection.destroy();
+ if (connection != null)
+ {
+ connection.destroy();
+ }
connection = null;
}
@@ -975,7 +978,15 @@
if (reconnectAttempts != -1 && count == reconnectAttempts)
{
- log.warn("Tried " + reconnectAttempts + " times to connect. Now giving up on reconnecting it.");
+ if (reconnectAttempts != 1)
+ {
+ log.warn("Tried " + reconnectAttempts + " times to connect. Now giving up on reconnecting it.");
+ }
+ else
+ if (reconnectAttempts == 1)
+ {
+ log.debug("Trying to connect towards " + this);
+ }
return;
}
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java 2011-07-18 17:05:58 UTC (rev 10994)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java 2011-07-18 22:05:10 UTC (rev 10995)
@@ -13,14 +13,13 @@
package org.hornetq.core.client.impl;
-import org.hornetq.api.core.HornetQException;
+import java.util.concurrent.Executor;
+
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.ServerLocator;
-import java.util.concurrent.Executor;
-
/**
* A ServerLocatorInternal
*
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2011-07-18 17:05:58 UTC (rev 10994)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2011-07-18 22:05:10 UTC (rev 10995)
@@ -537,20 +537,8 @@
{
}
- if (me.getCode() == HornetQException.DISCONNECTED)
- {
- fail(true);
- }
- else
- {
- fail(false);
- }
+ fail(false);
- scheduleRetryReconnect(me.getCode());
- }
-
- protected void scheduleRetryReconnect(int errorCode)
- {
scheduleRetryConnect();
}
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionBridge.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionBridge.java 2011-07-18 17:05:58 UTC (rev 10994)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionBridge.java 2011-07-18 22:05:10 UTC (rev 10995)
@@ -140,15 +140,6 @@
}
@Override
- protected void scheduleRetryReconnect(int errorCode)
- {
- if (errorCode != HornetQException.DISCONNECTED)
- {
- scheduleRetryConnect();
- }
- }
-
- @Override
protected ServerMessage beforeForward(ServerMessage message)
{
// We make a copy of the message, then we strip out the unwanted routing id headers and leave
Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-07-18 17:05:58 UTC (rev 10994)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-07-18 22:05:10 UTC (rev 10995)
@@ -13,7 +13,6 @@
package org.hornetq.tests.integration.cluster.distribution;
-import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
@@ -913,7 +912,7 @@
{
String br = "-------------------------\n";
String out = br;
- out += "HornetQ server " + server.getNodeID() + "\n";
+ out += "HornetQ server " + server + "\n";
ClusterManager clusterManager = server.getClusterManager();
if (clusterManager == null)
{
@@ -1791,7 +1790,7 @@
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
address,
name,
- 100,
+ 500,
true,
forwardWhenNoConsumers,
maxHops,
@@ -1995,6 +1994,19 @@
ClusterTestBase.log.info("started server " + node);
waitForServer(servers[node]);
+
+ for (int i = 0 ; i <= node; i++)
+ {
+ try
+ {
+ log.info("Describing Server " + servers[i]);
+ log.info(servers[i].describe());
+ }
+ catch (Throwable ignored)
+ {
+
+ }
+ }
}
}
@@ -2041,7 +2053,7 @@
{
ClusterTestBase.log.info("stopping server " + node);
servers[node].stop();
- ClusterTestBase.log.info("server stopped");
+ ClusterTestBase.log.info("server " + node + " stopped");
}
catch (Exception e)
{
Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java 2011-07-18 17:05:58 UTC (rev 10994)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java 2011-07-18 22:05:10 UTC (rev 10995)
@@ -314,29 +314,33 @@
verifyReceiveRoundRobin(10, 0, 1);
verifyNotReceive(0, 1);
- System.out.println(clusterDescription(servers[0]));
- System.out.println(clusterDescription(servers[1]));
- System.out.println(clusterDescription(servers[2]));
- System.out.println(clusterDescription(servers[3]));
- System.out.println(clusterDescription(servers[4]));
+ log.info("============================================ before restart");
+ log.info(clusterDescription(servers[0]));
+ log.info(clusterDescription(servers[1]));
+ log.info(clusterDescription(servers[2]));
+ log.info(clusterDescription(servers[3]));
+ log.info(clusterDescription(servers[4]));
stopServers(2);
Thread.sleep(2000);
- System.out.println(clusterDescription(servers[0]));
- System.out.println(clusterDescription(servers[1]));
- System.out.println(clusterDescription(servers[3]));
- System.out.println(clusterDescription(servers[4]));
+ log.info("============================================ after stop");
+ log.info(clusterDescription(servers[0]));
+ log.info(clusterDescription(servers[1]));
+ log.info(clusterDescription(servers[3]));
+ log.info(clusterDescription(servers[4]));
+
startServers(2);
Thread.sleep(2000);
- System.out.println(clusterDescription(servers[0]));
- System.out.println(clusterDescription(servers[1]));
- System.out.println(clusterDescription(servers[2]));
- System.out.println(clusterDescription(servers[3]));
- System.out.println(clusterDescription(servers[4]));
+ log.info("============================================ after start");
+ log.info(clusterDescription(servers[0]));
+ log.info(clusterDescription(servers[1]));
+ log.info(clusterDescription(servers[2]));
+ log.info(clusterDescription(servers[3]));
+ log.info(clusterDescription(servers[4]));
send(0, "queues.testaddress", 10, false, null);
13 years, 8 months
JBoss hornetq SVN: r10994 - branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication.
by do-not-reply@jboss.org
Author: borges
Date: 2011-07-18 13:05:58 -0400 (Mon, 18 Jul 2011)
New Revision: 10994
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java
Log:
Improve tests following review
Modified: branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java 2011-07-18 16:32:01 UTC (rev 10993)
+++ branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java 2011-07-18 17:05:58 UTC (rev 10994)
@@ -38,6 +38,7 @@
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
@@ -260,58 +261,51 @@
public void testSendPacketsWithFailure() throws Exception
{
- int nMsg = 100;
+ final int nMsg = 100;
+ final int stop = 37;
setupServer(true, false, TestInterceptor.class.getName());
manager = liveServer.getReplicationManager();
waitForComponent(manager);
- final ClientSession session = locator.createSessionFactory().createSession();
+ ClientSessionFactory sf = locator.createSessionFactory();
+ final ClientSession session = sf.createSession();
+ final ClientSession session2 = sf.createSession();
session.createQueue(ADDRESS, ADDRESS, null, true);
final ClientProducer producer = session.createProducer(ADDRESS);
- sendMessages(session, producer, nMsg);
- // Now we start intercepting the communication with the backup
- TestInterceptor.value.set(false);
- sendMessages(session, producer, nMsg);
session.start();
+ session2.start();
try
{
- final ClientConsumer consumer = session.createConsumer(ADDRESS);
- for (int i = 0; i < 2 * nMsg; i++)
+ final ClientConsumer consumer = session2.createConsumer(ADDRESS);
+ for (int i = 0; i < nMsg; i++)
{
- ClientMessage message = consumer.receive(1000);
- Assert.assertNotNull("Message should exist!", message);
- if (i < nMsg)
- {
- assertMessageBody(i, message);
- Assert.assertEquals(i, message.getIntProperty("counter").intValue());
- }
- message.acknowledge();
- }
- final CountDownLatch latch = new CountDownLatch(1);
- liveServer.getStorageManager().afterCompleteOperations(new IOAsyncTask()
- {
-
- public void onError(final int errorCode, final String errorMessage)
+ ClientMessage message = session.createMessage(true);
+ setBody(i, message);
+ message.putIntProperty("counter", i);
+ producer.send(message);
+ if (i == stop)
{
+ // Now we start intercepting the communication with the backup
+ TestInterceptor.value.set(false);
}
-
- public void done()
- {
- latch.countDown();
- }
- });
-
- Assert.assertTrue(latch.await(20, TimeUnit.SECONDS));
+ ClientMessage msgRcvd = consumer.receive(1000);
+ Assert.assertNotNull("Message should exist!", msgRcvd);
+ assertMessageBody(i, msgRcvd);
+ Assert.assertEquals(i, msgRcvd.getIntProperty("counter").intValue());
+ msgRcvd.acknowledge();
+ }
}
finally
{
TestInterceptor.value.set(false);
if (!session.isClosed())
session.commit();
+ if (!session2.isClosed())
+ session2.commit();
}
}
13 years, 8 months
JBoss hornetq SVN: r10993 - branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication.
by do-not-reply@jboss.org
Author: borges
Date: 2011-07-18 12:32:01 -0400 (Mon, 18 Jul 2011)
New Revision: 10993
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java
Log:
Rewrite testSendPacketsWithFailure()
Modified: branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java 2011-07-18 16:31:27 UTC (rev 10992)
+++ branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java 2011-07-18 16:32:01 UTC (rev 10993)
@@ -34,6 +34,10 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
@@ -93,6 +97,7 @@
private ServerLocator locator;
private ReplicationManager manager;
+ private static final SimpleString ADDRESS = new SimpleString("foobar123");
// Static --------------------------------------------------------
@@ -102,7 +107,6 @@
private void setupServer(boolean backup, boolean netty, String... interceptors) throws Exception
{
- assert backup; // XXX
Configuration backupConfig = createDefaultConfig(netty);
Configuration liveConfig = createDefaultConfig(netty);
@@ -129,10 +133,23 @@
backupServer = new HornetQServerImpl(backupConfig);
locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
backupServer.start();
- Thread.sleep(200); // XXX improve this
waitForComponent(backupServer);
+ int count = 0;
+ waitForReplication(count);
}
+ private void waitForReplication(int count) throws InterruptedException
+ {
+ if (liveServer == null)
+ return;
+
+ while (liveServer.getReplicationManager() == null && count < 10)
+ {
+ Thread.sleep(50);
+ count++;
+ }
+ }
+
private static void waitForComponent(HornetQComponent component) throws Exception
{
waitForComponent(component, 3);
@@ -204,8 +221,8 @@
blockOnReplication(storage, manager);
PagingManager pagingManager =
- createPageManager(backupServer.getStorageManager(), backupServer.getConfiguration(), backupServer.getExecutorFactory(),
- backupServer.getAddressSettingsRepository());
+ createPageManager(backupServer.getStorageManager(), backupServer.getConfiguration(),
+ backupServer.getExecutorFactory(), backupServer.getAddressSettingsRepository());
PagingStore store = pagingManager.getPageStore(dummy);
store.start();
@@ -243,39 +260,59 @@
public void testSendPacketsWithFailure() throws Exception
{
-
+ int nMsg = 100;
setupServer(true, false, TestInterceptor.class.getName());
- StorageManager storage = getStorage();
manager = liveServer.getReplicationManager();
+ waitForComponent(manager);
+ final ClientSession session = locator.createSessionFactory().createSession();
+ session.createQueue(ADDRESS, ADDRESS, null, true);
- Journal replicatedJournal = new ReplicatedJournal((byte)1, new FakeJournal(), manager);
+ final ClientProducer producer = session.createProducer(ADDRESS);
+ sendMessages(session, producer, nMsg);
+ // Now we start intercepting the communication with the backup
TestInterceptor.value.set(false);
+ sendMessages(session, producer, nMsg);
- for (int i = 0; i < 500; i++)
+ session.start();
+ try
{
- replicatedJournal.appendAddRecord(i, (byte)1, new FakeData(), false);
- }
-
- final CountDownLatch latch = new CountDownLatch(1);
- storage.afterCompleteOperations(new IOAsyncTask()
- {
-
- public void onError(final int errorCode, final String errorMessage)
+ final ClientConsumer consumer = session.createConsumer(ADDRESS);
+ for (int i = 0; i < 2 * nMsg; i++)
{
+ ClientMessage message = consumer.receive(1000);
+ Assert.assertNotNull("Message should exist!", message);
+ if (i < nMsg)
+ {
+ assertMessageBody(i, message);
+ Assert.assertEquals(i, message.getIntProperty("counter").intValue());
+ }
+ message.acknowledge();
}
- public void done()
+ final CountDownLatch latch = new CountDownLatch(1);
+ liveServer.getStorageManager().afterCompleteOperations(new IOAsyncTask()
{
- latch.countDown();
- }
- });
- backupServer.stop();
+ public void onError(final int errorCode, final String errorMessage)
+ {
+ }
- Assert.assertTrue(latch.await(50, TimeUnit.SECONDS));
+ public void done()
+ {
+ latch.countDown();
+ }
+ });
+ Assert.assertTrue(latch.await(20, TimeUnit.SECONDS));
+ }
+ finally
+ {
+ TestInterceptor.value.set(false);
+ if (!session.isClosed())
+ session.commit();
+ }
}
public void testExceptionSettingActionBefore() throws Exception
@@ -532,7 +569,6 @@
}
-
protected
PagingManager
createPageManager(final StorageManager storageManager,
13 years, 8 months
JBoss hornetq SVN: r10992 - in branches/HORNETQ-720_Replication/tests: unit-tests/src/test/java/org/hornetq/tests/util and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2011-07-18 12:31:27 -0400 (Mon, 18 Jul 2011)
New Revision: 10992
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
Log:
Remove constants from ServiceTestBase as they just repeat values from UnitTestCase
Modified: branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-07-18 16:30:35 UTC (rev 10991)
+++ branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-07-18 16:31:27 UTC (rev 10992)
@@ -250,17 +250,8 @@
final int numMessages = 10;
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session.createMessage(true);
+ sendMessages(session, producer, numMessages);
- setBody(i, message);
-
- message.putIntProperty("counter", i);
-
- producer.send(message);
- }
-
session.commit();
ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS);
@@ -334,18 +325,8 @@
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
+ sendMessages(session, producer, NUM_MESSAGES);
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- ClientMessage message = session.createMessage(true);
-
- setBody(i, message);
-
- message.putIntProperty("counter", i);
-
- producer.send(message);
- }
-
ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS);
session.start();
@@ -1885,25 +1866,6 @@
return TransportConfigurationUtils.getInVMConnector(live);
}
- /**
- * @param i
- * @param message
- */
- protected void assertMessageBody(final int i, final ClientMessage message)
- {
- Assert.assertEquals("message" + i, message.getBodyBuffer().readString());
- }
-
- /**
- * @param i
- * @param message
- * @throws Exception
- */
- protected void setBody(final int i, final ClientMessage message) throws Exception
- {
- message.getBodyBuffer().writeString("message" + i);
- }
-
protected void beforeRestart(TestableServer liveServer)
{
}
Modified: branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java 2011-07-18 16:30:35 UTC (rev 10991)
+++ branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java 2011-07-18 16:31:27 UTC (rev 10992)
@@ -18,7 +18,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.client.ClientMessage;
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.logging.Logger;
import org.hornetq.tests.util.UnitTestCase;
@@ -37,11 +36,11 @@
private static final Logger log = Logger.getLogger(LargeMessageFailoverTest.class);
-
+
private static final int MIN_LARGE_MESSAGE = 1024;
-
+
private static final int LARGE_MESSAGE_SIZE = MIN_LARGE_MESSAGE * 3;
-
+
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
@@ -53,7 +52,7 @@
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
-
+
/**
* @param name
*/
@@ -63,7 +62,7 @@
}
/**
- *
+ *
*/
public LargeMessageFailoverTest()
{
@@ -96,8 +95,9 @@
Assert.assertEquals("equal at " + j, buffer.readByte(), UnitTestCase.getSamplebyte(j));
}
}
-
+
+ @Override
protected ServerLocatorInternal getServerLocator() throws Exception
{
ServerLocator locator = super.getServerLocator();
Modified: branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-07-18 16:30:35 UTC (rev 10991)
+++ branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-07-18 16:31:27 UTC (rev 10992)
@@ -26,6 +26,7 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.HornetQClient;
@@ -62,14 +63,6 @@
// Attributes ----------------------------------------------------
- protected static final String INVM_ACCEPTOR_FACTORY = InVMAcceptorFactory.class.getCanonicalName();
-
- public static final String INVM_CONNECTOR_FACTORY = InVMConnectorFactory.class.getCanonicalName();
-
- protected static final String NETTY_ACCEPTOR_FACTORY = NettyAcceptorFactory.class.getCanonicalName();
-
- protected static final String NETTY_CONNECTOR_FACTORY = NettyConnectorFactory.class.getCanonicalName();
-
private final List<ServerLocator> locators = new ArrayList<ServerLocator>();
@Override
@@ -489,6 +482,44 @@
}
/**
+ * @param i
+ * @param message
+ * @throws Exception
+ */
+ protected void setBody(final int i, final ClientMessage message) throws Exception
+ {
+ message.getBodyBuffer().writeString("message" + i);
+ }
+
+ /**
+ * @param i
+ * @param message
+ */
+ protected void assertMessageBody(final int i, final ClientMessage message)
+ {
+ Assert.assertEquals("message" + i, message.getBodyBuffer().readString());
+ }
+
+ /**
+ * Send messages with pre-specified body.
+ * @param session
+ * @param producer
+ * @param numMessages
+ * @throws Exception
+ */
+ public void sendMessages(ClientSession session, ClientProducer producer, int numMessages) throws Exception
+ {
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createMessage(true);
+ setBody(i, message);
+ message.putIntProperty("counter", i);
+ producer.send(message);
+ }
+ }
+
+
+ /**
* Deleting a file on LargeDire is an asynchronous process. We need to keep looking for a while
* if the file hasn't been deleted yet.
*/
13 years, 8 months
JBoss hornetq SVN: r10991 - branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/api/core/client.
by do-not-reply@jboss.org
Author: borges
Date: 2011-07-18 12:30:35 -0400 (Mon, 18 Jul 2011)
New Revision: 10991
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/api/core/client/ClientSession.java
Log:
Correct the parameter order in the javadoc.
Modified: branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/api/core/client/ClientSession.java
===================================================================
--- branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/api/core/client/ClientSession.java 2011-07-15 22:47:48 UTC (rev 10990)
+++ branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/api/core/client/ClientSession.java 2011-07-18 16:30:35 UTC (rev 10991)
@@ -22,18 +22,18 @@
/**
* A ClientSession is a single-thread object required for producing and consuming messages.
- *
+ *
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
* @author <a href="mailto:ataylor@redhat.com">Andy Taylor</a>
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
+ *
*/
public interface ClientSession extends XAResource
{
/**
* Information returned by a binding query
- *
+ *
* @see ClientSession#bindingQuery(SimpleString)
*/
public interface BindingQuery
@@ -51,7 +51,7 @@
/**
* Information returned by a queue query
- *
+ *
* @see ClientSession#queueQuery(SimpleString)
*/
public interface QueueQuery
@@ -92,7 +92,7 @@
/**
* Starts the session.
* The session must be started before ClientConsumers created by the session can consume messages from the queue.
- *
+ *
* @throws HornetQException if an exception occurs while starting the session
*/
void start() throws HornetQException;
@@ -100,35 +100,35 @@
/**
* Stops the session.
* ClientConsumers created by the session can not consume messages when the session is stopped.
- *
+ *
* @throws HornetQException if an exception occurs while stopping the session
*/
void stop() throws HornetQException;
/**
* Closes the session.
- *
+ *
* @throws HornetQException if an exception occurs while closing the session
*/
void close() throws HornetQException;
/**
* Returns whether the session is closed or not.
- *
+ *
* @return <code>true</code> if the session is closed, <code>false</code> else
*/
boolean isClosed();
/**
* Adds a FailureListener to the session which is notified if a failure occurs on the session.
- *
+ *
* @param listener the listener to add
*/
void addFailureListener(SessionFailureListener listener);
/**
* Removes a FailureListener to the session.
- *
+ *
* @param listener the listener to remove
* @return <code>true</code> if the listener was removed, <code>false</code> else
*/
@@ -136,7 +136,7 @@
/**
* Returns the server's incrementingVersion.
- *
+ *
* @return the server's <code>incrementingVersion</code>
*/
int getVersion();
@@ -145,7 +145,7 @@
/**
* Creates a <em>non-temporary</em> queue.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @param durable whether the queue is durable or not
@@ -155,7 +155,7 @@
/**
* Creates a <em>non-temporary</em> queue.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @param durable whether the queue is durable or not
@@ -165,16 +165,16 @@
/**
* Creates a <em>non-temporary</em> queue <em>non-durable</em> queue.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @throws HornetQException in an exception occurs while creating the queue
*/
void createQueue(String address, String queueName) throws HornetQException;
-
+
/**
* Creates a <em>non-temporary</em> queue <em>non-durable</em> queue.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @throws HornetQException in an exception occurs while creating the queue
@@ -183,18 +183,17 @@
/**
* Creates a <em>non-temporary</em> queue.
- *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
- * @param durable whether the queue is durable or not
* @param filter only messages which match this filter will be put in the queue
+ * @param durable whether the queue is durable or not
* @throws HornetQException in an exception occurs while creating the queue
*/
void createQueue(SimpleString address, SimpleString queueName, SimpleString filter, boolean durable) throws HornetQException;
/**
* Creates a <em>non-temporary</em>queue.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @param durable whether the queue is durable or not
@@ -205,7 +204,7 @@
/**
* Creates a <em>temporary</em> queue.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @throws HornetQException in an exception occurs while creating the queue
@@ -214,7 +213,7 @@
/**
* Creates a <em>temporary</em> queue.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @throws HornetQException in an exception occurs while creating the queue
@@ -223,7 +222,7 @@
/**
* Creates a <em>temporary</em> queue with a filter.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @param filter only messages which match this filter will be put in the queue
@@ -233,7 +232,7 @@
/**
* Creates a <em>temporary</em> queue with a filter.
- *
+ *
* @param address the queue will be bound to this address
* @param queueName the name of the queue
* @param filter only messages which match this filter will be put in the queue
@@ -243,7 +242,7 @@
/**
* Deletes the queue.
- *
+ *
* @param queueName the name of the queue to delete
* @throws HornetQException if there is no queue for the given name or if the queue has consumers
*/
@@ -251,7 +250,7 @@
/**
* Deletes the queue.
- *
+ *
* @param queueName the name of the queue to delete
* @throws HornetQException if there is no queue for the given name or if the queue has consumers
*/
@@ -261,7 +260,7 @@
/**
* Creates a ClientConsumer to consume message from the queue with the given name.
- *
+ *
* @param queueName name of the queue to consume messages from
* @return a ClientConsumer
* @throws HornetQException if an exception occurs while creating the ClientConsumer
@@ -270,7 +269,7 @@
/**
* Creates a ClientConsumer to consume messages from the queue with the given name.
- *
+ *
* @param queueName name of the queue to consume messages from
* @return a ClientConsumer
* @throws HornetQException if an exception occurs while creating the ClientConsumer
@@ -279,7 +278,7 @@
/**
* Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.
- *
+ *
* @param queueName name of the queue to consume messages from
* @param filter only messages which match this filter will be consumed
* @return a ClientConsumer
@@ -289,7 +288,7 @@
/**
* Creates a ClientConsumer to consume messages matching the filter from the queue with the given name.
- *
+ *
* @param queueName name of the queue to consume messages from
* @param filter only messages which match this filter will be consumed
* @return a ClientConsumer
@@ -303,7 +302,7 @@
* but they will not be consumed (the messages will remain in the queue).
* If <code>browseOnly</code> is <code>false</code>, the ClientConsumer will behave like consume the messages from the queue and
* the messages will effectively be removed from the queue.
- *
+ *
* @param queueName name of the queue to consume messages from
* @param browseOnly whether the ClientConsumer will only browse the queue or consume messages.
* @return a ClientConsumer
@@ -317,7 +316,7 @@
* but they will not be consumed (the messages will remain in the queue).
* If <code>browseOnly</code> is <code>false</code>, the ClientConsumer will behave like consume the messages from the queue and
* the messages will effectively be removed from the queue.
- *
+ *
* @param queueName name of the queue to consume messages from
* @param browseOnly whether the ClientConsumer will only browse the queue or consume messages.
* @return a ClientConsumer
@@ -331,7 +330,7 @@
* but they will not be consumed (the messages will remain in the queue).
* If <code>browseOnly</code> is <code>false</code>, the ClientConsumer will behave like consume the messages from the queue and
* the messages will effectively be removed from the queue.
- *
+ *
* @param queueName name of the queue to consume messages from
* @param filter only messages which match this filter will be consumed
* @param browseOnly whether the ClientConsumer will only browse the queue or consume messages.
@@ -346,7 +345,7 @@
* but they will not be consumed (the messages will remain in the queue).
* If <code>browseOnly</code> is <code>false</code>, the ClientConsumer will behave like consume the messages from the queue and
* the messages will effectively be removed from the queue.
- *
+ *
* @param queueName name of the queue to consume messages from
* @param filter only messages which match this filter will be consumed
* @param browseOnly whether the ClientConsumer will only browse the queue or consume messages.
@@ -361,7 +360,7 @@
* but they will not be consumed (the messages will remain in the queue).
* If <code>browseOnly</code> is <code>false</code>, the ClientConsumer will behave like consume the messages from the queue and
* the messages will effectively be removed from the queue.
- *
+ *
* @param queueName name of the queue to consume messages from
* @param filter only messages which match this filter will be consumed
* @param windowSize the consumer window size
@@ -382,7 +381,7 @@
* but they will not be consumed (the messages will remain in the queue).
* If <code>browseOnly</code> is <code>false</code>, the ClientConsumer will behave like consume the messages from the queue and
* the messages will effectively be removed from the queue.
- *
+ *
* @param queueName name of the queue to consume messages from
* @param filter only messages which match this filter will be consumed
* @param windowSize the consumer window size
@@ -398,7 +397,7 @@
/**
* Creates a producer with no default address.
* Address must be specified every time a message is sent
- *
+ *
* @return a ClientProducer
*
* @see ClientProducer#send(SimpleString, org.hornetq.api.core.Message)
@@ -407,7 +406,7 @@
/**
* Creates a producer which sends messages to the given address
- *
+ *
* @param address the address to send messages to
* @return a ClientProducer
* @throws HornetQException if an exception occurs while creating the ClientProducer
@@ -416,7 +415,7 @@
/**
* Creates a producer which sends messages to the given address
- *
+ *
* @param address the address to send messages to
* @return a ClientProducer
* @throws HornetQException if an exception occurs while creating the ClientProducer
@@ -425,7 +424,7 @@
/**
* Creates a producer which sends messages to the given address
- *
+ *
* @param address the address to send messages to
* @param rate the producer rate
* @return a ClientProducer
@@ -437,7 +436,7 @@
/**
* Creates a ClientMessage.
- *
+ *
* @param durable whether the created message is durable or not
* @return a ClientMessage
*/
@@ -445,7 +444,7 @@
/**
* Creates a ClientMessage.
- *
+ *
* @param type type of the message
* @param durable whether the created message is durable or not
* @return a ClientMessage
@@ -454,7 +453,7 @@
/**
* Creates a ClientMessage.
- *
+ *
* @param type type of the message
* @param durable whether the created message is durable or not
* @param expiration the message expiration
@@ -468,20 +467,20 @@
/**
* Queries information on a queue.
- *
+ *
* @param queueName the name of the queue to query
* @return a QueueQuery containing information on the given queue
- *
+ *
* @throws HornetQException if an exception occurs while querying the queue
*/
QueueQuery queueQuery(SimpleString queueName) throws HornetQException;
/**
* Queries information on a binding.
- *
+ *
* @param address the address of the biding to query
* @return a BindingQuery containing information on the binding attached to the given address
- *
+ *
* @throws HornetQException if an exception occurs while querying the binding
*/
BindingQuery bindingQuery(SimpleString address) throws HornetQException;
@@ -490,44 +489,44 @@
/**
* Returns the XAResource associated to the session.
- *
+ *
* @return the XAResource associated to the session
*/
XAResource getXAResource();
/**
* Return <code>true</code> if the session supports XA, <code>false</code> else.
- *
+ *
* @return <code>true</code> if the session supports XA, <code>false</code> else.
*/
boolean isXA();
/**
* Commits the current transaction.
- *
+ *
* @throws HornetQException if an exception occurs while committing the transaction
*/
void commit() throws HornetQException;
/**
* Rolls back the current transaction.
- *
+ *
* @throws HornetQException if an exception occurs while rolling back the transaction
*/
void rollback() throws HornetQException;
/**
* Rolls back the current transaction.
- *
+ *
* @param considerLastMessageAsDelivered the first message on deliveringMessage Buffer is considered as delivered
- *
+ *
* @throws HornetQException if an exception occurs while rolling back the transaction
*/
void rollback(boolean considerLastMessageAsDelivered) throws HornetQException;
/**
* Returns <code>true</code> if the current transaction has been flagged to rollback, <code>false</code> else.
- *
+ *
* @return <code>true</code> if the current transaction has been flagged to rollback, <code>false</code> else.
*/
boolean isRollbackOnly();
@@ -535,7 +534,7 @@
/**
* Returns whether the session will <em>automatically</em> commit its transaction every time a message is sent
* by a ClientProducer created by this session, <code>false</code> else
- *
+ *
* @return <code>true</code> if the session <em>automatically</em> commit its transaction every time a message is sent, <code>false</code> else
*/
boolean isAutoCommitSends();
@@ -543,28 +542,28 @@
/**
* Returns whether the session will <em>automatically</em> commit its transaction every time a message is acknowledged
* by a ClientConsumer created by this session, <code>false</code> else
- *
+ *
* @return <code>true</code> if the session <em>automatically</em> commit its transaction every time a message is acknowledged, <code>false</code> else
*/
boolean isAutoCommitAcks();
/**
* Returns whether the ClientConsumer created by the session will <em>block</em> when they acknowledge a message.
- *
+ *
* @return <code>true</code> if the session's ClientConsumer block when they acknowledge a message, <code>false</code> else
*/
boolean isBlockOnAcknowledge();
/**
* Sets a <code>SendAcknowledgementHandler</code> for this session.
- *
+ *
* @param handler a SendAcknowledgementHandler
*/
void setSendAcknowledgementHandler(SendAcknowledgementHandler handler);
/**
* Attach any metadata to the session.
- * @throws HornetQException
+ * @throws HornetQException
*/
void addMetaData(String key, String data) throws HornetQException;
@@ -572,7 +571,7 @@
* Attach any metadata to the session.
* Sends a Metadata using the older version
* @deprecated Use {@link ClientSession#addMetaData(String, String)}
- * @throws HornetQException
+ * @throws HornetQException
*/
void addMetaDataV1(String key, String data) throws HornetQException;
}
13 years, 8 months
JBoss hornetq SVN: r10990 - in branches/Branch_2_2_EAP_cluster_clean2: src/main/org/hornetq/core/server/impl and 2 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-07-15 18:47:48 -0400 (Fri, 15 Jul 2011)
New Revision: 10990
Modified:
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionBridge.java
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java
Log:
Fixing tests
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2011-07-14 23:29:23 UTC (rev 10989)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2011-07-15 22:47:48 UTC (rev 10990)
@@ -546,6 +546,11 @@
fail(false);
}
+ scheduleRetryReconnect(me.getCode());
+ }
+
+ protected void scheduleRetryReconnect(int errorCode)
+ {
scheduleRetryConnect();
}
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionBridge.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionBridge.java 2011-07-14 23:29:23 UTC (rev 10989)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionBridge.java 2011-07-15 22:47:48 UTC (rev 10990)
@@ -140,6 +140,15 @@
}
@Override
+ protected void scheduleRetryReconnect(int errorCode)
+ {
+ if (errorCode != HornetQException.DISCONNECTED)
+ {
+ scheduleRetryConnect();
+ }
+ }
+
+ @Override
protected ServerMessage beforeForward(ServerMessage message)
{
// We make a copy of the message, then we strip out the unwanted routing id headers and leave
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java 2011-07-14 23:29:23 UTC (rev 10989)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java 2011-07-15 22:47:48 UTC (rev 10990)
@@ -232,7 +232,7 @@
{
return HandleStatus.BUSY;
}
-
+
// If there is a pendingLargeMessage we can't take another message
// This has to be checked inside the lock as the set to null is done inside the lock
if (largeMessageInDelivery)
@@ -240,6 +240,11 @@
return HandleStatus.BUSY;
}
+ if (log.isTraceEnabled())
+ {
+ log.trace("Handling reference " + ref);
+ }
+
final ServerMessage message = ref.getMessage();
if (filter != null && !filter.match(message))
Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-07-14 23:29:23 UTC (rev 10989)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-07-15 22:47:48 UTC (rev 10990)
@@ -839,6 +839,7 @@
final int... consumerIDs) throws Exception
{
boolean outOfOrder = false;
+ String firstOutOfOrderMessage = null;
for (int consumerID : consumerIDs)
{
ConsumerHolder holder = consumers[consumerID];
@@ -860,11 +861,11 @@
dumpConsumers();
- Assert.assertNotNull("consumer " + consumerID + " did not receive message " + j, message);
+ Assert.fail("consumer " + consumerID + " did not receive message " + j);
}
+
+ log.info("msg on ClusterTestBase = " + message);
-
-
if (ack)
{
message.acknowledge();
@@ -877,15 +878,22 @@
if (j != (Integer)message.getObjectProperty(ClusterTestBase.COUNT_PROP))
{
+ if (firstOutOfOrderMessage == null)
+ {
+ firstOutOfOrderMessage = "expected " + j + " received " + message.getObjectProperty(ClusterTestBase.COUNT_PROP);
+ }
outOfOrder = true;
System.out.println("Message j=" + j +
" was received out of order = " +
message.getObjectProperty(ClusterTestBase.COUNT_PROP));
+ log.info("Message j=" + j +
+ " was received out of order = " +
+ message.getObjectProperty(ClusterTestBase.COUNT_PROP));
}
}
}
- Assert.assertFalse("Messages were consumed out of order, look at System.out for more information", outOfOrder);
+ Assert.assertFalse("Messages were consumed out of order::" + firstOutOfOrderMessage, outOfOrder);
}
private void dumpConsumers() throws Exception
Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java 2011-07-14 23:29:23 UTC (rev 10989)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java 2011-07-15 22:47:48 UTC (rev 10990)
@@ -15,6 +15,7 @@
import java.util.Collection;
import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.logging.Logger;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
@@ -24,6 +25,8 @@
*/
public class ClusterRestartTest extends ClusterTestBase
{
+ Logger log = Logger.getLogger(ClusterRestartTest.class);
+
public void testRestartWithQueuesCreateInDiffOrder() throws Exception
{
setupServer(0, isFileStorage(), isNetty());
@@ -71,12 +74,11 @@
sendInRange(1, "queues.testaddress", 0, 10, true, null);
- System.out.println("stopping******************************************************");
+ log.info("stopping******************************************************");
stopServers(0);
+ log.info("stopped, waiting 2 seconds************************************");
Thread.sleep(2000);
- System.out.println("stopped******************************************************");
startServers(0);
-
waitForBindings(0, "queues.testaddress", 1, 1, true);
waitForBindings(1, "queues.testaddress", 1, 0, true);
13 years, 8 months
JBoss hornetq SVN: r10989 - branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-07-14 19:29:23 -0400 (Thu, 14 Jul 2011)
New Revision: 10989
Modified:
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
tweak
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-07-14 23:28:11 UTC (rev 10988)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-07-14 23:29:23 UTC (rev 10989)
@@ -23,12 +23,10 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.Callable;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
13 years, 8 months
JBoss hornetq SVN: r10988 - branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-07-14 19:28:11 -0400 (Thu, 14 Jul 2011)
New Revision: 10988
Modified:
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
fixing test
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-07-14 18:39:50 UTC (rev 10987)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-07-14 23:28:11 UTC (rev 10988)
@@ -1376,9 +1376,9 @@
csf = conn.tryConnect();
- if (csf != null || ServerLocatorImpl.this.closed || ServerLocatorImpl.this.closing)
+ if (csf != null)
{
- break;
+ return csf;
}
}
@@ -1387,7 +1387,10 @@
break;
}
- Thread.sleep (retryInterval);
+ if (!closed && !closing)
+ {
+ Thread.sleep (retryInterval);
+ }
}
}
13 years, 8 months
JBoss hornetq SVN: r10987 - branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-07-14 14:39:50 -0400 (Thu, 14 Jul 2011)
New Revision: 10987
Modified:
branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
Fixing test
Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-07-14 17:09:28 UTC (rev 10986)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-07-14 18:39:50 UTC (rev 10987)
@@ -1363,8 +1363,10 @@
try
{
+ int retryNumber = 0;
while (csf == null && !ServerLocatorImpl.this.closed && !ServerLocatorImpl.this.closing)
{
+ retryNumber ++;
for (Connector conn : connectors)
{
if (log.isDebugEnabled())
@@ -1380,6 +1382,11 @@
}
}
+ if (initialConnectAttempts >=0 && retryNumber > initialConnectAttempts)
+ {
+ break;
+ }
+
Thread.sleep (retryInterval);
}
13 years, 8 months