summaryrefslogtreecommitdiff
path: root/java/systests/src
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
commite2c93f78c54c600f894b3540f0679463c5e4837a (patch)
treee8b22f653ef5c5f9a59941f6232a0227bde77132 /java/systests/src
parenta3b5a0b03c308afd4e7f298cc21f51d5e9323639 (diff)
downloadqpid-python-e2c93f78c54c600f894b3540f0679463c5e4837a.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/qpid@757696 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java b/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
index 289ca0b1b0..5970d105eb 100644
--- a/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
+++ b/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)
{