summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorAidan Skinner <aidan@apache.org>2009-01-22 12:19:47 +0000
committerAidan Skinner <aidan@apache.org>2009-01-22 12:19:47 +0000
commit0456f0ffca2b7d2981a2de043b7635ff606dc62b (patch)
tree4c3ac77247d48324e67a3fe05c3a37f8aaa3ac02 /qpid/java
parentfdfcd42316aa5bd8418166ed072d9be40f0a2431 (diff)
downloadqpid-python-0456f0ffca2b7d2981a2de043b7635ff606dc62b.tar.gz
QPID-1418: Destroy and recreate consumer once all messages are
sent so that they have enough time to expire. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@736618 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
index 02db795534..834222fcc2 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
@@ -55,8 +55,13 @@ public class TimeToLiveTest extends QpidTestCase
Session clientSession = clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = clientSession.createQueue(QUEUE);
-
+
+ // Create then close the consumer so the queue is actually created
+ // Closing it then reopening it ensures that the consumer shouldn't get messages
+ // which should have expired and allows a shorter sleep period. See QPID-1418
+
MessageConsumer consumer = clientSession.createConsumer(queue);
+ consumer.close();
//Create Producer
Connection producerConnection = getConnection();
@@ -82,10 +87,11 @@ public class TimeToLiveTest extends QpidTestCase
producer.setTimeToLive(0L);
producer.send(nextMessage(String.valueOf(msg), false, producerSession, producer));
- try
+ consumer = clientSession.createConsumer(queue);
+ try
{
// Sleep to ensure TTL reached
- Thread.sleep(2000);
+ Thread.sleep(TIME_TO_LIVE);
}
catch (InterruptedException e)
{