You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2009/06/03 21:22:27 UTC

svn commit: r781515 - /qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java

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:commits-subscribe@qpid.apache.org