Author: timfox
Date: 2010-04-10 06:47:48 -0400 (Sat, 10 Apr 2010)
New Revision: 9091
Modified:
trunk/src/main/org/hornetq/utils/PriorityLinkedListImpl.java
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java
Log:
fixed consumer round robin test
Modified: trunk/src/main/org/hornetq/utils/PriorityLinkedListImpl.java
===================================================================
--- trunk/src/main/org/hornetq/utils/PriorityLinkedListImpl.java 2010-04-10 09:40:22 UTC
(rev 9090)
+++ trunk/src/main/org/hornetq/utils/PriorityLinkedListImpl.java 2010-04-10 10:47:48 UTC
(rev 9091)
@@ -62,20 +62,16 @@
public int addFirst(final T t, final int priority)
{
- int refs = size.incrementAndGet();
-
levels[priority].addFirst(t);
- return refs;
+ return size.incrementAndGet();
}
public int addLast(final T t, final int priority)
{
- int refs = size.incrementAndGet();
-
levels[priority].addLast(t);
- return refs;
+ return size.incrementAndGet();
}
public T removeFirst()
Modified:
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java 2010-04-10
09:40:22 UTC (rev 9090)
+++
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java 2010-04-10
10:47:48 UTC (rev 9091)
@@ -20,6 +20,7 @@
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -28,10 +29,26 @@
*/
public class ConsumerRoundRobinTest extends ServiceTestBase
{
+ private static final Logger log = Logger.getLogger(QueueBrowserTest.class);
+
public final SimpleString addressA = new SimpleString("addressA");
public final SimpleString queueA = new SimpleString("queueA");
+ public void test() throws Exception
+ {
+ for (int i = 0; i < 100000; i++)
+ {
+ log.info("**** ITER " + i + "\n\n\n\n\n\n");
+
+ this.testConsumersRoundRobinCorrectly();
+
+ tearDown();
+
+ setUp();
+ }
+ }
+
public void testConsumersRoundRobinCorrectly() throws Exception
{
HornetQServer server = createServer(false);
@@ -53,7 +70,6 @@
consumers[3] = session.createConsumer(queueA);
consumers[4] = session.createConsumer(queueA);
- // ClientSession sendSession = cf.createSession(false, true, true);
ClientProducer cp = session.createProducer(addressA);
int numMessage = 100;
for (int i = 0; i < numMessage; i++)
@@ -70,9 +86,10 @@
ClientMessage cm = consumers[j].receive(5000);
Assert.assertNotNull(cm);
Assert.assertEquals(currMessage++, cm.getBodyBuffer().readInt());
+ cm.acknowledge();
}
}
- // sendSession.close();
+ log.info("closing session");
session.close();
}
finally
Show replies by date