Author: ritchiem
Date: Tue Mar 24 09:48:45 2009
New Revision: 757696
URL: http://svn.apache.org/viewvc?rev=757696&view=rev
Log:
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.
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
URL:
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java?rev=757696&r1=757695&r2=757696&view=diff
==============================================================================
---
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
(original)
+++
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
Tue Mar 24 09:48:45 2009
@@ -70,7 +70,9 @@
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 @@
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)
{
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]