Author: rajith
Date: Wed Jun  3 19:22:27 2009
New Revision: 781515

URL: http://svn.apache.org/viewvc?rev=781515&view=rev
Log:
This is related to QPID-1887
I incorporated the review comments and made the following changes.
The current time is generated only if ttl is set or disable Timestamp is set to 
false.
If ttl is set we set it and also calculate the expiration as current_time + ttl.

Modified:
    
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java

Modified: 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java?rev=781515&r1=781514&r2=781515&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
 (original)
+++ 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
 Wed Jun  3 19:22:27 2009
@@ -92,18 +92,22 @@
             messageProps.clearMessageId();
         }
 
+        long currentTime = 0;
+        if (timeToLive > 0 || !_disableTimestamps)
+        {
+            currentTime = System.currentTimeMillis();
+        }        
+        
+        if (timeToLive > 0)
+        {
+            deliveryProp.setTtl(timeToLive);
+            message.setJMSExpiration(currentTime + timeToLive);
+        }
+        
         if (!_disableTimestamps)
         {
-            final long currentTime = System.currentTimeMillis();
-            deliveryProp.setTimestamp(currentTime);
-            if (timeToLive > 0)
-            {
-                deliveryProp.setTtl(timeToLive);                
-            }
-            else
-            {
-               deliveryProp.setTtl(0);
-            }
+            
+            deliveryProp.setTimestamp(currentTime);            
             message.setJMSTimestamp(currentTime);
         }
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to