summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-03-24 09:48:45 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-03-24 09:48:45 +0000
commit26dd3000824ced31dc81c5bed3a524a3af78b943 (patch)
tree0ae803f09c7cca33f1ae8592353b03292c658b69 /qpid/java
parentbf4a3ad42dfc87bc61c5e18e743424847dd72ba4 (diff)
downloadqpid-python-26dd3000824ced31dc81c5bed3a524a3af78b943.tar.gz
QPID-1662 : Converted PassiveTTL to a transacted session so we can ensure all messages are on broker and aging before we start our sleep cycle. The transacted session won't affect the way messages age.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@757696 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.java7
1 files changed, 6 insertions, 1 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 289ca0b1b0..5970d105eb 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
@@ -70,7 +70,9 @@ public class TimeToLiveTest extends QpidTestCase
producerConnection.start();
- Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ // Move to a Transacted session to ensure that all messages have been delivered to broker before
+ // we start waiting for TTL
+ Session producerSession = producerConnection.createSession(true, Session.SESSION_TRANSACTED);
MessageProducer producer = producerSession.createProducer(queue);
@@ -89,12 +91,15 @@ public class TimeToLiveTest extends QpidTestCase
producer.setTimeToLive(0L);
producer.send(nextMessage(String.valueOf(msg), false, producerSession, producer));
+ producerSession.commit();
+
consumer = clientSession.createConsumer(queue);
// Ensure we sleep the required amount of time.
ReentrantLock waitLock = new ReentrantLock();
Condition wait = waitLock.newCondition();
final long MILLIS = 1000000L;
+
long waitTime = TIME_TO_LIVE * MILLIS;
while (waitTime > 0)
{